1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Should I use null for the value of a number - Angular

Discussão em 'Angular' iniciado por matt, Junho 3, 2025.

  1. matt

    matt Guest

    I want an input to initially be set to empty so I set the input's ngModel to null.

    <input [(ngModel)]="expenses" (keyup)="onKey($event)">


    The model is used like this:

    expenses: number = null;

    ...

    if (this.expenses.toString() === '') {
    this.inputHelperTextVisible = false;
    }


    Should I use null on a number?

    Continue reading...

Compartilhe esta Página