2

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 ""?

2 Answers2

2

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

Adya
  • 1,084
  • 9
  • 17
1

You can solve this also by using

null === undefined // false
null == undefined // true

by the use of strict comparison operator

Santa
  • 367
  • 2
  • 8