diff options
| author | Niall Smart | 2013-08-09 09:52:27 -0700 | 
|---|---|---|
| committer | Igor Minar | 2013-08-09 10:21:32 -0700 | 
| commit | 890e939fcc0e059b66a4868853d82e23fbc68ac3 (patch) | |
| tree | 9ef4cace5b75c76887401aa9c751735790848aad /src | |
| parent | 0b114fd3e1ce4cc120663222f2dfb34ee5dbda4c (diff) | |
| download | angular.js-890e939fcc0e059b66a4868853d82e23fbc68ac3.tar.bz2 | |
docs(ngModel): validators should return undefined for invalid values.
Closes #3525
Diffstat (limited to 'src')
| -rw-r--r-- | src/ng/directive/input.js | 8 | 
1 files changed, 5 insertions, 3 deletions
| diff --git a/src/ng/directive/input.js b/src/ng/directive/input.js index 7a07f271..6f3919df 100644 --- a/src/ng/directive/input.js +++ b/src/ng/directive/input.js @@ -817,6 +817,10 @@ var VALID_CLASS = 'ng-valid',   * @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. +       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 @@ -1042,11 +1046,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) { | 
