Why does {{ isNan(x) }} not work in angularJS?

Viewed 5416

Note the title of this question has changed to one that's more focused to the exact problem. See the comment stream to follow how it came about that I realized the problem is that AngularJS does not seem to handle {{ isNaN() }}

I have the following in my HTML:

xx {{ option.selectedSubject }} yy {{ (option.selectedSubject == null) }} zz

and I also tried:

xx {{ option.selectedSubject }} yy {{ option.selectedSubject == null }} z

and:

xx {{ option.selectedSubject }} yy {{ option.selectedSubject === null }} zz

Can someone help explain to me why I get the following for each of the above when I view my page:

xx null yy false zz

Update 1 I tried the following:

aa {{ option.selectedSubject === "null" }} bb {{ option.selectedSubject == "null" }} cc

and it gives this:

aa false bb false cc

Update 2 I am not sure if this helps but here's what populates the values of option.selectedSubject. In this case there's nothing in local storage:

$scope.option.selectedSubject = parseInt(localStorage.get('selectedSubject'));

When I check the value of $scope.option.selectedSubject it is NaN

2 Answers
Related