@@ -1758,12 +1758,11 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
1758
1758
* @description
1759
1759
* Runs each of the registered validations set on the $validators object.
1760
1760
*/
1761
- this . $validate = function ( modelValue , viewValue ) {
1762
- if ( arguments . length === 0 ) {
1763
- modelValue = ctrl . $modelValue ;
1764
- viewValue = ctrl . $viewValue ;
1765
- }
1761
+ this . $validate = function ( ) {
1762
+ this . $$runValidators ( ctrl . $modelValue , ctrl . $viewValue ) ;
1763
+ } ;
1766
1764
1765
+ this . $$runValidators = function ( modelValue , viewValue ) {
1767
1766
forEach ( ctrl . $validators , function ( fn , name ) {
1768
1767
ctrl . $setValidity ( name , fn ( modelValue , viewValue ) ) ;
1769
1768
} ) ;
@@ -1805,7 +1804,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
1805
1804
if ( ctrl . $modelValue !== modelValue &&
1806
1805
( isUndefined ( ctrl . $$invalidModelValue ) || ctrl . $$invalidModelValue != modelValue ) ) {
1807
1806
1808
- ctrl . $validate ( modelValue , viewValue ) ;
1807
+ ctrl . $$runValidators ( modelValue , viewValue ) ;
1809
1808
ctrl . $modelValue = ctrl . $valid ? modelValue : undefined ;
1810
1809
ctrl . $$invalidModelValue = ctrl . $valid ? undefined : modelValue ;
1811
1810
@@ -1897,7 +1896,7 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
1897
1896
viewValue = formatters [ idx ] ( viewValue ) ;
1898
1897
}
1899
1898
1900
- ctrl . $validate ( modelValue , viewValue ) ;
1899
+ ctrl . $$runValidators ( modelValue , viewValue ) ;
1901
1900
ctrl . $modelValue = ctrl . $valid ? modelValue : undefined ;
1902
1901
ctrl . $$invalidModelValue = ctrl . $valid ? undefined : modelValue ;
1903
1902
0 commit comments