Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit 890e939

Browse files
Niall SmartIgorMinar
Niall Smart
authored andcommitted
docs(ngModel): validators should return undefined for invalid values.
Closes #3525
1 parent 0b114fd commit 890e939

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ng/directive/input.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -817,6 +817,10 @@ var VALID_CLASS = 'ng-valid',
817817
* @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever
818818
the control reads value from the DOM. Each function is called, in turn, passing the value
819819
through to the next. Used to sanitize / convert the value as well as validation.
820+
For validation, the parsers should update the validity state using
821+
{@link ng.directive:ngModel.NgModelController#$setValidity $setValidity()},
822+
and return `undefined` for invalid values.
823+
820824
*
821825
* @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever
822826
the model value changes. Each function is called, in turn, passing the value through to the
@@ -1042,11 +1046,9 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
10421046
* For example {@link ng.directive:input input} or
10431047
* {@link ng.directive:select select} directives call it.
10441048
*
1045-
* It internally calls all `parsers` (including validators) and updates the `$modelValue` and the actual model path.
1049+
* It internally calls all `$parsers` (including validators) and updates the `$modelValue` and the actual model path.
10461050
* Lastly it calls all registered change listeners.
10471051
*
1048-
* If validators determine the value is invalid, the `$modelValue` and the model path will be set to `undefined`.
1049-
*
10501052
* @param {string} value Value from the view.
10511053
*/
10521054
this.$setViewValue = function(value) {

0 commit comments

Comments
 (0)