@@ -177,6 +177,8 @@ defaultModelOptions = new ModelOptions({
177
177
* `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
178
178
* to have access to the updated model.
179
179
*
180
+ * ### Overriding immediate updates
181
+ *
180
182
* The following example shows how to override immediate updates. Changes on the inputs within the
181
183
* form will update the model only when the control loses focus (blur event). If `escape` key is
182
184
* pressed while the input field is focused, the value is reset to the value in the current model.
@@ -236,6 +238,8 @@ defaultModelOptions = new ModelOptions({
236
238
* </file>
237
239
* </example>
238
240
*
241
+ * ### Debouncing updates
242
+ *
239
243
* The next example shows how to debounce model changes. Model will be updated only 1 sec after last change.
240
244
* If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.
241
245
*
@@ -260,6 +264,7 @@ defaultModelOptions = new ModelOptions({
260
264
* </file>
261
265
* </example>
262
266
*
267
+ *
263
268
* ## Model updates and validation
264
269
*
265
270
* The default behaviour in `ngModel` is that the model value is set to `undefined` when the
@@ -307,20 +312,41 @@ defaultModelOptions = new ModelOptions({
307
312
* You can specify the timezone that date/time input directives expect by providing its name in the
308
313
* `timezone` property.
309
314
*
315
+ *
316
+ * ## Programmatically changing options
317
+ *
318
+ * The `ngModelOptions` expression is only evaluated once when the directive is linked; it is not
319
+ * watched for changes. However, it is possible to override the options on a single
320
+ * {@link ngModel.NgModelController} instance with
321
+ * {@link ngModel.NgModelController#$overrideModelOptions `NgModelController#$overrideModelOptions()`}.
322
+ *
323
+ *
310
324
* @param {Object } ngModelOptions options to apply to {@link ngModel} directives on this element and
311
325
* and its descendents. Valid keys are:
312
326
* - `updateOn`: string specifying which event should the input be bound to. You can set several
313
327
* events using an space delimited list. There is a special event called `default` that
314
- * matches the default events belonging to the control.
328
+ * matches the default events belonging to the control. These are the events that are bound to
329
+ * the control, and when fired, update the `$viewValue` via `$setViewValue`.
330
+ *
331
+ * `ngModelOptions` considers every event that is not listed in `updateOn` a "default" event,
332
+ * since different control types use different default events.
333
+ *
334
+ * See also the section {@link ngModelOptions#triggering-and-debouncing-model-updates
335
+ * Triggering and debouncing model updates}.
336
+ *
315
337
* - `debounce`: integer value which contains the debounce model update value in milliseconds. A
316
338
* value of 0 triggers an immediate update. If an object is supplied instead, you can specify a
317
339
* custom value for each event. For example:
318
340
* ```
319
341
* ng-model-options="{
320
- * updateOn: 'default blur',
342
+ * updateOn: 'default blur click ',
321
343
* debounce: { 'default': 500, 'blur': 0 }
322
344
* }"
323
345
* ```
346
+ *
347
+ * "default" also applies to all events that are listed in `updateOn` but are not
348
+ * listed in `debounce`, i.e. "click" would also be debounced by 500 milliseconds.
349
+ *
324
350
* - `allowInvalid`: boolean value which indicates that the model can be set with values that did
325
351
* not validate correctly instead of the default behavior of setting the model to undefined.
326
352
* - `getterSetter`: boolean value which determines whether or not to treat functions bound to
0 commit comments