The $$ parseAndValidate () function has such a check.

if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) { // ctrl.$modelValue has not been touched yet... ctrl.$modelValue = ngModelGet($scope); } 

When does the condition work? What is this strange check?
GiHub source code

  • What is the $$parseAndValidate() function? Where is this code torn from? Which of the three operations produced in the code is incomprehensible? - Grundy
  • I wrote the code in the function of the NgModelController controller. ctrl. $ modelValue contains the value of the input. It interests me under what conditions the if-part (isNumber (ctrl. $ ModelValue) && isNaN (ctrl. $ ModelValue)) works. It turns out that the value is being checked simultaneously on isNumber and on isNaN. - Denis Matyushev
  • It is worth adding a link to the place where you saw it. obviously if will work when the value is NaN - Grundy
  • The link indicated in the question - Denis Matyushev
  • for the line in question - Grundy

0