Ng-if - check for null value

I have a loop that goes through a dataset and determines the folder setting for the href. I have an ng-if for each of the parameters, but I need to add a check to one of the ng-ifs. I need a way to check if the value is null. I used something like:

 ng-if="!shortcut.SAM3Link" 

      

The problem is that if the value in my database is not null but doesn't matter, it won't recognize the difference. I need a way to specifically check for null and not have a value.

Basically, I need a way to determine between the null value in my database and the text / space using ng-if.

+3


source to share


2 answers


You need to use the operator strict equality : shortcut.SAM3Link === null

.



ng-if="shortcut.SAM3Link === null" 

      

+8


source


ng-if - check the null value of an array



  • ng-if="shortcut.SAM3Link === null"

  • ng-if="shortcut.SAM3Link.length === 0"

0


source







All Articles