New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

ngx-nullable

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ngx-nullable

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

latest
Source
npmnpm
Version
0.3.2
Version published
Maintainers
1
Created
Source

NgxNullable

npm version Package License NPM Downloads Snyk codecov stars forks HitCount

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

Angular 21 compatible

Here's the demo

  • Lightweight
  • No dependencies!

🛠️ Install

  • Use yarn (or npm) to install the package
yarn add ngx-nullable
  • Add provideNullable into your config (optional)
import { provideNullable } from 'ngx-nullable';

export const appConfig: 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({
  // ...
})
class Example {
  private readonly nullable = inject(NgxNullableService);
  public readonly input = signal<string>('');
  public readonly computed = 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 - 2025 Dominik Hladik

All contents are licensed under the MIT license.

Keywords

angular

FAQs

Package last updated on 25 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts