Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

This library provides a way to make properties nullable in Angular templates.

License

NotificationsYou must be signed in to change notification settings

Celtian/ngx-nullable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

59 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

NgxNullable

npm versionPackage LicenseNPM DownloadsSnykcodecovstarsforksHitCount

This library provides a way to make properties nullable in Angular templates.

Angular 20 compatible

Here's thedemo

  • Lightweight
  • No dependencies!

🛠️ Install

  1. Use yarn (or npm) to install the package
yarn add ngx-nullable
  1. AddprovideNullable into your config (optional)
import{provideNullable}from'ngx-nullable';exportconstappConfig:ApplicationConfig={providers:[// ...provideNullable({character:'---',separator:' | ',displayZero:true})]};

or module

import{provideNullable}from'ngx-nullable';  @NgModule({// ...providers:[// ...provideNullable({character:'---',separator:' | ',displayZero:true})]})

🚀 Quick start

Pipe example

<ul><li>{{ -1000 | ngxNullable }}</li><li>{{ 1000 | ngxNullable }}</li><li>{{ 0 | ngxNullable }}</li><li>{{ null | ngxNullable }}</li><li>{{ undefined | ngxNullable }}</li><li>{{ 'string' | ngxNullable }}</li><li>{{ '' | ngxNullable }}</li><li>{{ ' ' | ngxNullable }}</li></ul><ul><li>{{ ['', ' ', undefined, null] | ngxNullableJoin }}</li><li>{{ ['AAA', 'BBB', 'CCC'] | ngxNullableJoin }}</li><li>{{ ['AAA', '', ' ', undefined, null, 'BBB'] | ngxNullableJoin }}</li><li>{{ [] | ngxNullableJoin }}</li></ul>

Signals example

@Component({// ...})classExample{privatereadonlynullable=inject(NgxNullableService);publicreadonlyinput=signal<string>('');publicreadonlycomputed=computed(()=>this.nullable.fromString(this.input()));}

🛠️ Options

Root options

OptionTypeDefaultDescription
characterstring'—'The character to display when the value is null or undefined
separatorstring', 'The separator to use when joining multiple values
displayZerobooleantrueWhether to display zero when the value is zero

📦 Dependencies

None

🪪 License

Copyright © 2024 - 2025Dominik Hladik

All contents are licensed under theMIT license.

About

This library provides a way to make properties nullable in Angular templates.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

[8]ページ先頭

©2009-2025 Movatter.jp