Search code examples
angularangular-ng-if

Undefined and Null in *NgIf


Are null, undefined and ""<empty string> value treated similarly by *Ngif? For example, is this: *ngIf = "foo == null"

Treated the same as: *ngIf = "foo == undefined"

If not, is there a simpler way to use *ngIf to not show properties with the value null, undefined, and ""?


Solution

  • You can simply check *ngIf = "foo" that can check undefined and null or empty.