Does angularjs treates null as $scope.null?

angularjs, angularjs-scope

Solution

No, Angular recognizes some JS primitives in expressions, and `null` is among them.

Problem

Example for the question ``` <div ng-show="bar !== null">hello</div> ``` Is this evaluated in the scope as ``` $scope.bar !== null ``` or is it as this? ``` $scope.bar !== $scope.null ``` Note that in last case, $scope.null would be undefined and the example would seem to work right. Bonus: if bar = null then this happens ``` // this does not work (shows hello) <div ng-show="bar !== null">hello</div> ``` does not give the same result as ``` // this works ok (does not show hello) <div ng-show="bar != null">hello</div> ``` why does that happen?

Original source