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

Commit 8f283fe

Browse files
hupfpetebacondarwin
authored andcommitted
docs(NgModelController): clarify documentation of $setViewValue
$setViewValue does not really "Read a value from view". It should be called to trigger the ngModel to be updated when the value in the view changes. Closes #4907
1 parent cb8061c commit 8f283fe

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/ng/directive/input.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1103,14 +1103,19 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
11031103
* @methodOf ng.directive:ngModel.NgModelController
11041104
*
11051105
* @description
1106-
* Read a value from view.
1106+
* Update the view value.
11071107
*
1108-
* This method should be called from within a DOM event handler.
1109-
* For example {@link ng.directive:input input} or
1108+
* This method should be called when the view value changes, typically from within a DOM event handler.
1109+
* For example {@link ng.directive:input input} and
11101110
* {@link ng.directive:select select} directives call it.
11111111
*
1112-
* It internally calls all `$parsers` (including validators) and updates the `$modelValue` and the actual model path.
1113-
* Lastly it calls all registered change listeners.
1112+
* It will update the $viewValue, then pass this value through each of the functions in `$parsers`,
1113+
* which includes any validators. The value that comes out of this `$parsers` pipeline, be applied to
1114+
* `$modelValue` and the **expression** specified in the `ng-model` attribute.
1115+
*
1116+
* Lastly, all the registered change listeners, in the `$viewChangeListeners` list, are called.
1117+
*
1118+
* Note that calling this function does not trigger a `$digest`.
11141119
*
11151120
* @param {string} value Value from the view.
11161121
*/

0 commit comments

Comments
 (0)