0.0.7 • Published 6 months ago

ngx-nullish v0.0.7

Weekly downloads
7
License
MIT
Repository
github
Last release
6 months ago

ngx-nullish

node version npm version downloads count size license github-ci

šŸ”Ø Angular Structural Directive which replace *ngIf by Nullish Coalescing operator.

Give a ā­ļø if this project helped you!

Motivation

Nobody likes "Falsy Values".

When in your stream (RxJS) are numbers (include 0), *ngIf will coerce 0 to false, means UI will not update.

Preview šŸŽ‰

https://piecioshka.github.io/ngx-nullish-demo/

Features

  • āœ… Returns falsy only for: null, undefined
    • *ngIf returns falsy for: null, undefined, 0, -0, false, NaN, ''

Usage

Installation:

npm install ngx-nullish
  1. Import deps

    import { NgxNullishModule } from 'ngx-nullish';
    
    @NgModule({
        imports: [
            ...
            NgxNullishModule
        ],
        ...
    })
    export class AppModule { }
  2. Update template

    <p *ngIf="numbers$ | async as num">
        {{ num }}
    </p>

    replace to:

    <p *ngxNullish="numbers$ | async as num">
        {{ num }}
    </p>

Deployment

Please run a script:

./scripts/deploy.sh

License

The MIT License @ 2020

0.0.7

6 months ago

0.0.3

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.6

9 months ago

0.0.2

5 years ago

0.0.1

5 years ago