@@ -364,7 +364,12 @@ export class NgModelController {
364364 * @returns {boolean } True if `value` is "empty".
365365 */
366366 $isEmpty ( value ) {
367- return isUndefined ( value ) || value === "" || value === null || isNaN ( value ) ;
367+ return (
368+ isUndefined ( value ) ||
369+ value === "" ||
370+ value === null ||
371+ Number . isNaN ( value )
372+ ) ;
368373 }
369374
370375 $$updateEmptyClasses ( value ) {
@@ -825,7 +830,8 @@ export class NgModelController {
825830
826831 function writeToModelIfNeeded ( ) {
827832 // intentional loose equality
828- if ( that . $modelValue !== prevModelValue ) {
833+ // eslint-disable-next-line eqeqeq
834+ if ( that . $modelValue != prevModelValue ) {
829835 that . $$writeModelToScope ( ) ;
830836 }
831837 }
@@ -1210,7 +1216,7 @@ export function ngModelDirective() {
12101216 deregisterWatch ( ) ;
12111217 } ) ;
12121218 } ,
1213- post : ( scope , element , _attr , ctrls ) => {
1219+ post : ( scope , elementPost , _attr , ctrls ) => {
12141220 const modelCtrl = ctrls [ 0 ] ;
12151221
12161222 modelCtrl . $$setUpdateOnEvents ( ) ;
@@ -1219,13 +1225,13 @@ export function ngModelDirective() {
12191225 modelCtrl . $setTouched ( ) ;
12201226 }
12211227
1222- element . addEventListener ( "blur" , ( ) => {
1228+ elementPost . addEventListener ( "blur" , ( ) => {
12231229 if ( modelCtrl . $touched ) return ;
12241230 setTouched ( ) ;
12251231 } ) ;
12261232
12271233 modelCtrl . $viewChangeListeners . push ( ( ) =>
1228- scope . $eval ( element . dataset . change ) ,
1234+ scope . $eval ( elementPost . dataset . change ) ,
12291235 ) ;
12301236 } ,
12311237 } ;
0 commit comments