feat(upgrade): propagate touched state of NgModelController

This commit is contained in:
Sergey Shevchenko
2017-07-06 20:46:20 +03:00
committed by Alex Rickabaugh
parent e03adb9edd
commit 59c23c7bd7
3 changed files with 23 additions and 0 deletions

View File

@ -90,6 +90,9 @@ export function hookupNgModel(ngModel: angular.INgModelController, component: an
if (ngModel && supportsNgModel(component)) {
ngModel.$render = () => { component.writeValue(ngModel.$viewValue); };
component.registerOnChange(ngModel.$setViewValue.bind(ngModel));
if (typeof component.registerOnTouched === 'function') {
component.registerOnTouched(ngModel.$setTouched.bind(ngModel));
}
}
}