Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs ng if-检查空值_Angularjs_If Statement - Fatal编程技术网

Angularjs ng if-检查空值

Angularjs ng if-检查空值,angularjs,if-statement,Angularjs,If Statement,我有一个循环,它通过一个数据集运行,并确定a href的文件夹设置。对于每个选项,我都有一个ng if,但我需要在其中一个ng if中添加一个检查。我需要一种检查值是否为null的方法。我使用了类似于: ng-if="!shortcut.SAM3Link" 问题是,如果数据库中的值不是null,但没有值,则无法识别差异。我需要一种专门检查null的方法,而不是没有值 基本上,我需要一种方法来确定数据库中的NULL值和使用ng if的text/blank 您需要使用:shortcut.SAM

我有一个循环,它通过一个数据集运行,并确定a href的文件夹设置。对于每个选项,我都有一个ng if,但我需要在其中一个ng if中添加一个检查。我需要一种检查值是否为null的方法。我使用了类似于:

 ng-if="!shortcut.SAM3Link" 
问题是,如果数据库中的值不是null,但没有值,则无法识别差异。我需要一种专门检查null的方法,而不是没有值

基本上,我需要一种方法来确定数据库中的NULL值和使用ng if的text/blank

您需要使用:
shortcut.SAM3Link===null

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

ng if-检查数组的空值

  • ng if=“shortcut.SAM3Link==null”

  • ng if=“shortcut.SAM3Link.length==0”


  • 这是有效的,但只有两个相等。所以shortcut.SAM3Link==null。非常感谢。我已经尝试过使用ng if=“shortcut.SAM3Link!==null”和ng if=“shortcut.SAM3Link!==null”来查找相反的值,所以不是空值,但没有任何运气。有什么想法吗?@Miriam什么不起作用?请注意,
    undefined==null
    true
    undefined==null
    为false。而且,
    ==
    的否定是
    ==
    ,而
    =
    中的一个是
    =。使用三个等号并没有按我的需要过滤掉,但使用两个等号过滤掉了。谢谢你的解释。我可以使用!=对于我的第二个问题,这是我所需要的。非常感谢。