mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-20 00:10:26 +00:00
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
This commit is contained in:
parent
cb8061c75c
commit
8f283fe473
1 changed files with 10 additions and 5 deletions
|
|
@ -1103,14 +1103,19 @@ var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$
|
|||
* @methodOf ng.directive:ngModel.NgModelController
|
||||
*
|
||||
* @description
|
||||
* Read a value from view.
|
||||
* Update the view value.
|
||||
*
|
||||
* This method should be called from within a DOM event handler.
|
||||
* For example {@link ng.directive:input input} or
|
||||
* This method should be called when the view value changes, typically from within a DOM event handler.
|
||||
* For example {@link ng.directive:input input} and
|
||||
* {@link ng.directive:select select} directives call it.
|
||||
*
|
||||
* It internally calls all `$parsers` (including validators) and updates the `$modelValue` and the actual model path.
|
||||
* Lastly it calls all registered change listeners.
|
||||
* It will update the $viewValue, then pass this value through each of the functions in `$parsers`,
|
||||
* which includes any validators. The value that comes out of this `$parsers` pipeline, be applied to
|
||||
* `$modelValue` and the **expression** specified in the `ng-model` attribute.
|
||||
*
|
||||
* Lastly, all the registered change listeners, in the `$viewChangeListeners` list, are called.
|
||||
*
|
||||
* Note that calling this function does not trigger a `$digest`.
|
||||
*
|
||||
* @param {string} value Value from the view.
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in a new issue