aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiall Smart2013-08-09 09:52:27 -0700
committerIgor Minar2013-08-09 10:24:48 -0700
commit1dd5d2ec1fee5b19bd93112d640e9c4db09acf97 (patch)
tree0109042907053af77c59c4e75352b9a41b360cf6
parent6da835f4bc746651e662f9f2bb6de6d85d77aa47 (diff)
downloadangular.js-1dd5d2ec1fee5b19bd93112d640e9c4db09acf97.tar.bz2
docs(ngModel): validators should return undefined for invalid values.
Closes #3525
-rw-r--r--src/ng/directive/input.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js
index 6a4a5f9e..2d4f32e3 100644
--- a/src/ng/directive/input.js
+++ b/src/ng/directive/input.js
@@ -794,8 +794,12 @@ var VALID_CLASS = 'ng-valid',
* @property {string} $viewValue Actual string value in the view.
* @property {*} $modelValue The value in the model, that the control is bound to.
* @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever
- * the control reads value from the DOM. Each function is called, in turn, passing the value
- * through to the next. Used to sanitize / convert the value as well as validation.
+ the control reads value from the DOM. Each function is called, in turn, passing the value
+ through to the next. Used to sanitize / convert the value as well as validation.
+
+ For validation, the parsers should update the validity state using
+ {@link ng.directive:ngModel.NgModelController#$setValidity $setValidity()},
+ and return `undefined` for invalid values.
*
* @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever
* the model value changes. Each function is called, in turn, passing the value through to the
@@ -1005,11 +1009,9 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
* For example {@link ng.directive:input input} or
* {@link ng.directive:select select} directives call it.
*
- * It internally calls all `parsers` (including validators) and updates the `$modelValue` and the actual model path.
+ * It internally calls all `$parsers` (including validators) and updates the `$modelValue` and the actual model path.
* Lastly it calls all registered change listeners.
*
- * If validators determine the value is invalid, the `$modelValue` and the model path will be set to `undefined`.
- *
* @param {string} value Value from the view.
*/
this.$setViewValue = function(value) {