举例问题
<div ng-show="bar !== null">hello</div>
这是在范围评为
$scope.bar !== null
或者是因为这?
$scope.bar !== $scope.null
请注意,在最后一种情况下,$ scope.null将是不确定的和例子似乎工作的权利。
Note that in last case, $scope.null would be undefined and the example would seem to work right.
奖励:
如果巴= null,则发生这种情况。
if bar = null then this happens
// this does not work (shows hello)
<div ng-show="bar !== null">hello</div>
不给相同的结果
// this works ok (does not show hello)
<div ng-show="bar != null">hello</div>
为什么会发生呢?
why does that happen?
没有,角识别在EX pressions一些JS原语和空
就是其中之一。
No, Angular recognizes some JS primitives in expressions, and null
is among them.