NgxNullish
⚒ Angular Structural Directive which replace *ngIf
by Nullish Coalescing operator.
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.
Features
- ✅ Returns falsy only for
null
andundefined
*ngIf
returns falsy for:null
,undefined
,0
,-0
,false
,NaN
,''
Installation
npm install ngx-nullish
Usage
-
Import deps
;@ -
Update template
{{ num }}replace to:
{{ num }}
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Show your support
Give a ⭐️ if this project helped you!
License
The MIT License @ 2020