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

Commit e101c12

Browse files
docs(ngModelOptions): fix param name and tidy up examples
1 parent 3d31a15 commit e101c12

File tree

1 file changed

+38
-36
lines changed

1 file changed

+38
-36
lines changed

src/ng/directive/input.js

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2206,41 +2206,43 @@ var ngValueDirective = function() {
22062206
* @name ngModelOptions
22072207
*
22082208
* @description
2209-
* Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of events
2210-
* that will trigger a model update and/or a debouncing delay so that the actual update only takes place
2211-
* when a timer expires; this timer will be reset after another change takes place.
2209+
* Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of
2210+
* events that will trigger a model update and/or a debouncing delay so that the actual update only
2211+
* takes place when a timer expires; this timer will be reset after another change takes place.
22122212
*
2213-
* @param {Object=} Object that contains options to apply to the current model. Valid keys are:
2214-
* - updateOn: string specifying which event should be the input bound to. You can set several events
2215-
* using an space delimited list. There is a special event called `default` that
2216-
* matches the default events belonging of the control.
2217-
* - debounce: integer value which contains the debounce model update value in milliseconds. A value of 0
2218-
* triggers an immediate update. If an object is supplied instead, you can specify a custom value
2219-
* for each event. I.e.
2220-
* `ngModelOptions="{ updateOn: 'default blur', debounce: {'default': 500, 'blur': 0} }"`
2213+
* @param {Object} ngModelOptions options to apply to the current model. Valid keys are:
2214+
* - `updateOn`: string specifying which event should be the input bound to. You can set several
2215+
* events using an space delimited list. There is a special event called `default` that
2216+
* matches the default events belonging of the control.
2217+
* - `debounce`: integer value which contains the debounce model update value in milliseconds. A
2218+
* value of 0 triggers an immediate update. If an object is supplied instead, you can specify a
2219+
* custom value for each event. For example:
2220+
* `ngModelOptions="{ updateOn: 'default blur', debounce: {'default': 500, 'blur': 0} }"`
22212221
*
22222222
* @example
22232223
2224-
The following example shows how to override immediate updates. Changes on the inputs within the form will update the model
2225-
only when the control loses focus (blur event).
2224+
The following example shows how to override immediate updates. Changes on the inputs within the
2225+
form will update the model only when the control loses focus (blur event).
22262226
2227-
<example name="ngModelOptions-directive-1">
2227+
<example name="ngModelOptions-directive-blur">
22282228
<file name="index.html">
2229-
<script>
2230-
function Ctrl($scope) {
2231-
$scope.user = { name: 'say', data: '' };
2232-
}
2233-
</script>
22342229
<div ng-controller="Ctrl">
2235-
<form>
2236-
Name:
2237-
<input type="text" ng-model="user.name" ng-model-options="{ updateOn: 'blur' }" name="uName" /><br />
2238-
Other data:
2239-
<input type="text" ng-model="user.data" name="uData" /><br />
2240-
</form>
2230+
Name:
2231+
<input type="text"
2232+
ng-model="user.name"
2233+
ng-model-options="{ updateOn: 'blur' }" /><br />
2234+
2235+
Other data:
2236+
<input type="text" ng-model="user.data" /><br />
2237+
22412238
<pre>user.name = <span ng-bind="user.name"></span></pre>
22422239
</div>
22432240
</file>
2241+
<file name="app.js">
2242+
function Ctrl($scope) {
2243+
$scope.user = { name: 'say', data: '' };
2244+
}
2245+
</file>
22442246
<file name="protractor.js" type="protractor">
22452247
var model = element(by.binding('user.name'));
22462248
var input = element(by.model('user.name'));
@@ -2256,21 +2258,21 @@ var ngValueDirective = function() {
22562258
22572259
This one shows how to debounce model changes. Model will be updated only 500 milliseconds after last change.
22582260
2259-
<example name="ngModelOptions-directive-2">
2261+
<example name="ngModelOptions-directive-debounce">
22602262
<file name="index.html">
2261-
<script>
2262-
function Ctrl($scope) {
2263-
$scope.user = { name: 'say' };
2264-
}
2265-
</script>
2266-
<div ng-controller="Ctrl">
2267-
<form>
2268-
Name:
2269-
<input type="text" ng-model="user.name" name="uName" ng-model-options="{ debounce: 500 }" /><br />
2270-
</form>
2263+
<div ng-controller="Ctrl">
2264+
Name:
2265+
<input type="text"
2266+
ng-model="user.name"
2267+
ng-model-options="{ debounce: 500 }" /><br />
22712268
<pre>user.name = <span ng-bind="user.name"></span></pre>
22722269
</div>
22732270
</file>
2271+
<file name="app.js">
2272+
function Ctrl($scope) {
2273+
$scope.user = { name: 'say' };
2274+
}
2275+
</file>
22742276
</example>
22752277
*/
22762278
var ngModelOptionsDirective = function() {

0 commit comments

Comments
 (0)