AngularJS ng,如果对象值为真或假
不完全确定这为什么不起作用。我试图隐藏一个AngularJS ng,如果对象值为真或假,angularjs,Angularjs,不完全确定这为什么不起作用。我试图隐藏一个col是driveThru的值为false还是等于'N' ng if=“location.driveThru===false | | location.driveThru==='N'” 但是,==false不起作用,我无法确定原因。如果它是一个布尔值,则更改为 "!location.driveThru' || location.driveThru === 'N' and==如果后面是字符串a,则使用引号括起的字符串 ng-if="location.dr
col
是driveThru的值为false还是等于'N'
ng if=“location.driveThru===false | | location.driveThru==='N'”
但是,
==false
不起作用,我无法确定原因。如果它是一个布尔值,则更改为
"!location.driveThru' || location.driveThru === 'N'
and==如果后面是字符串a,则使用引号括起的字符串
ng-if="location.driveThru === 'false' || location.driveThru === 'N'"
它是false还是null?它返回为
driveThru:true
或driveThru:false
使用属性名location
充满了危险,因为它也是窗口
全局变量的属性。最好将其名称更改为loc
或somethingLocation
(用域中有意义的短语替换something
)。这是一个布尔值,然后尝试jjust“!location.driveThru'| | location.driveThru=='N'@Hereticsmonkey错了,现在应该可以了