https://github.com/piecioshka/ngx-nullish
⚒ Angular Structural Directive which replace `*ngIf` by Nullish Coalescing operator.
https://github.com/piecioshka/ngx-nullish
angular coalescing directive ngif nullish structural
Last synced: 16 days ago
JSON representation
⚒ Angular Structural Directive which replace `*ngIf` by Nullish Coalescing operator.
- Host: GitHub
- URL: https://github.com/piecioshka/ngx-nullish
- Owner: piecioshka
- License: mit
- Created: 2020-06-20T22:17:25.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-20T13:38:43.000Z (3 months ago)
- Last Synced: 2025-04-03T11:12:24.454Z (23 days ago)
- Topics: angular, coalescing, directive, ngif, nullish, structural
- Language: TypeScript
- Homepage: https://piecioshka.github.io/ngx-nullish-demo/
- Size: 432 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- trackawesomelist - ngx-nullish (⭐2) - Angular Structural Directive, which replaces `*ngIf` with Nullish Coalescing operator. (Recently Updated / [Oct 20, 2024](/content/2024/10/20/README.md))
- awesome-angular - ngx-nullish - Angular Structural Directive, which replaces `*ngIf` with Nullish Coalescing operator. (Table of contents / Third Party Components)
- fucking-awesome-angular - ngx-nullish - Angular Structural Directive, which replaces `*ngIf` with Nullish Coalescing operator. (Table of contents / Third Party Components)
README
# ngx-nullish
[](https://www.npmjs.com/package/ngx-nullish)
[](https://badge.fury.io/js/ngx-nullish)
[](https://www.npmjs.com/package/ngx-nullish)
[](https://packagephobia.com/result?p=ngx-nullish)
[](https://piecioshka.mit-license.org)
[](https://github.com/piecioshka/ngx-nullish/actions/workflows/testing.yml)🔨 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 🎉
## Features
- ✅ Returns **falsy** _only_ for: `null`, `undefined`
- `*ngIf` returns **falsy** for: `null`, `undefined`, `0`, `-0`, `false`, `NaN`, `''`## Usage
Installation:
```bash
npm install ngx-nullish
```1. Import deps
```javascript
import { NgxNullishModule } from 'ngx-nullish';@NgModule({
imports: [
...
NgxNullishModule
],
...
})
export class AppModule { }
```2. Update template
```html
{{ num }}
```replace to:
```html
{{ num }}
```## Deployment
Please run a script:
```bash
./scripts/deploy.sh
```## License
[The MIT License](https://piecioshka.mit-license.org) @ 2020