0.0.7 ⢠Published 10 months ago
ngx-nullish v0.0.7
ngx-nullish
šØ 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*ngIfreturns falsy for:null,undefined,0,-0,false,NaN,''
Usage
Installation:
npm install ngx-nullishImport deps
import { NgxNullishModule } from 'ngx-nullish'; @NgModule({ imports: [ ... NgxNullishModule ], ... }) export class AppModule { }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.shLicense
The MIT License @ 2020