I am retrieving numbers (integer or float) from a MySQL database, and putting them in a form. I want a checkbox to be visible if the value is not null. However, ng-show and other directives don't seem able to check for null.
Ideally, I want:
<input type="checkbox" ng-hide = "{{x.thenumber === null}}" />
This does not hide any fields, even though some returned values are null.
x.thenumber == 0 matches nulls, but it also matches values of zero, which I don't want.
I have:
- tried different operators (!=, ==, ===).
- tried matching empty string, undefined, NaN
- confirmed in phpMyAdmin that these values are null
- confirmed in the generated HTML that there is nothing where the null value goes (like a space)
- tried different directives (ng-show if not null vs ng-hide if null)
- considered using JavaScript like typeof(), but it doesn't seem like you can do that in an AngularJS expression
Is there a secret to this? It seems like it should be possible, without having to build a custom filter or control.