I am writing a directive to cooperate with ngModel. As shown in the example, I set the $render function on the controller to my function.
When the code initializes, it is invoked twice, the first time with $modelValue and $viewValue set to NaN, and then a second time with the actual value of the model.
The problem is, NaN is a bear to test for. The function isNaN()
is worthless, so far as I can see (it returns false for [""]
but true for ["."]
) and Number.isNaN()
is not widely supported.
Any suggestions?