@angular-wave/angular.ts 0.0.41 → 0.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/README.md +27 -0
  2. package/dist/angular-ts.esm.js +2 -2
  3. package/dist/angular-ts.umd.js +2 -2
  4. package/package.json +1 -1
  5. package/src/core/compile/compile.js +1 -1
  6. package/src/core/compile/compile.md +2 -5
  7. package/src/core/exception-handler.js +6 -6
  8. package/src/core/interpolate/interpolate.js +1 -1
  9. package/src/core/location/location.spec.js +0 -4
  10. package/src/core/q/q.js +1 -1
  11. package/src/core/scope/scope.js +1 -1
  12. package/src/core/task-tracker-factory.js +2 -2
  13. package/src/core/timeout/timeout.js +1 -1
  14. package/src/core/url-utils/url-utils.js +0 -2
  15. package/src/directive/bind/bind.js +2 -2
  16. package/src/directive/change/change.js +1 -1
  17. package/src/directive/cloak/cloak.js +1 -1
  18. package/src/directive/events/events.js +1 -1
  19. package/src/directive/form/form.js +2 -2
  20. package/src/directive/init/init.js +1 -1
  21. package/src/directive/list/list.js +1 -1
  22. package/src/directive/model/model.js +1 -1
  23. package/src/directive/model-options/model-options.js +56 -421
  24. package/src/directive/model-options/model-options.md +407 -0
  25. package/src/directive/model-options/model-options.spec.js +1 -1
  26. package/src/directive/non-bindable/non-bindable.js +1 -2
  27. package/src/directive/style/style.js +1 -1
  28. package/src/directive/switch/switch.js +2 -2
  29. package/src/directive/transclude/transclude.js +2 -2
  30. package/src/index.js +0 -461
  31. package/src/loader.js +1 -1
  32. package/src/public.js +1 -1
  33. package/src/router/template-factory.js +2 -2
  34. package/src/router/view-scroll.js +1 -1
  35. package/src/services/browser.js +1 -1
  36. package/src/services/document.js +2 -2
  37. package/src/services/log.js +1 -1
  38. package/src/services/template-request.js +1 -1
  39. package/src/shared/jqlite/jqlite.js +52 -44
  40. package/src/shared/jqlite/jqlite.spec.js +0 -1
  41. package/src/shared/utils.js +1 -1
  42. package/src/types.js +447 -9
  43. package/tsconfig.json +1 -1
  44. package/types/animations/shared.d.ts +1 -1
  45. package/types/core/exception-handler.d.ts +5 -7
  46. package/types/core/interpolate/interpolate.d.ts +1 -1
  47. package/types/core/q/q.d.ts +1 -1
  48. package/types/core/task-tracker-factory.d.ts +5 -5
  49. package/types/core/timeout/timeout.d.ts +2 -2
  50. package/types/directive/bind/bind.d.ts +4 -4
  51. package/types/directive/change/change.d.ts +2 -2
  52. package/types/directive/cloak/cloak.d.ts +2 -2
  53. package/types/directive/init/init.d.ts +2 -2
  54. package/types/directive/list/list.d.ts +2 -2
  55. package/types/directive/model/model.d.ts +13 -7
  56. package/types/directive/model-options/model-options.d.ts +49 -0
  57. package/types/directive/non-bindable/non-bindable.d.ts +2 -3
  58. package/types/directive/style/style.d.ts +2 -2
  59. package/types/directive/switch/switch.d.ts +4 -4
  60. package/types/index.d.ts +1 -702
  61. package/types/public.d.ts +2 -2
  62. package/types/router/template-factory.d.ts +4 -4
  63. package/types/services/browser.d.ts +3 -3
  64. package/types/services/document.d.ts +4 -6
  65. package/types/services/log.d.ts +2 -2
  66. package/types/services/template-request.d.ts +1 -1
  67. package/types/shared/jqlite/jqlite.d.ts +10 -2
  68. package/types/shared/utils.d.ts +2 -2
  69. package/types/types.d.ts +437 -33
  70. package/types-back/index.d.ts +1 -27
  71. package/types-back/jqlite.d.ts +0 -81
  72. package/types-back/global.d.ts +0 -11
@@ -1,44 +1,73 @@
1
- /* eslint-disable no-use-before-define */
2
- import { extend, forEach, isDefined, trim } from "../../shared/utils";
1
+ import { forEach, isDefined, trim } from "../../shared/utils";
3
2
 
4
- /* exported defaultModelOptions */
5
- export let defaultModelOptions;
6
3
  const DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/;
7
4
 
8
5
  /**
9
- * @ngdoc type
10
- * @name ModelOptions
6
+ * @typedef {Object} ModelOptionsConfig
7
+ * @property {string} [updateOn] - A string specifying which events the input should be bound to. Multiple events can be set using a space-delimited list. The special event 'default' matches the default events belonging to the control.
8
+ * @property {number|Object.<string, number>} [debounce] - An integer specifying the debounce time in milliseconds. A value of 0 triggers an immediate update. If an object is supplied, custom debounce values can be set for each event.
9
+ * @property {boolean} [allowInvalid] - Indicates whether the model can be set with values that did not validate correctly. Defaults to false, which sets the model to undefined on validation failure.
10
+ * @property {boolean} [getterSetter] - Determines whether to treat functions bound to `ngModel` as getters/setters. Defaults to false.
11
+ * @property {boolean} [updateOnDefault]
12
+ */
13
+
14
+ class NgModelOptionsController {
15
+ static $inject = ["$attrs", "$scope"];
16
+
17
+ /**
18
+ * @param {import('../../types').Attributes} $attrs
19
+ * @param {import('../../types').TScope} $scope
20
+ */
21
+ constructor($attrs, $scope) {
22
+ this.$$attrs = $attrs;
23
+ this.$$scope = $scope;
24
+ /** @type {NgModelOptionsController?} */
25
+ this.parentCtrl;
26
+ }
27
+
28
+ $onInit() {
29
+ const parentOptions = this.parentCtrl
30
+ ? this.parentCtrl.$options
31
+ : defaultModelOptions;
32
+ const modelOptionsDefinition = this.$$scope.$eval(
33
+ this.$$attrs.ngModelOptions,
34
+ );
35
+
36
+ this.$options = parentOptions.createChild(modelOptionsDefinition);
37
+ }
38
+ }
39
+
40
+ /**
11
41
  * @description
12
42
  * A container for the options set by the {@link ngModelOptions} directive
13
43
  */
14
- function ModelOptions(options) {
15
- this.$$options = options;
16
- }
44
+ class ModelOptions {
45
+ /**
46
+ * @param {ModelOptionsConfig} options
47
+ */
48
+ constructor(options) {
49
+ /** @type {ModelOptionsConfig} */
50
+ this.$$options = options;
51
+ }
17
52
 
18
- ModelOptions.prototype = {
19
53
  /**
20
- * @ngdoc method
21
- * @name ModelOptions#getOption
22
- * @param {string} name the name of the option to retrieve
23
- * @returns {*} the value of the option
24
- * @description
25
54
  * Returns the value of the given option
55
+ * @param {string} name the name of the option to retrieve
56
+ * @returns {string|boolean|number|Object.<string, number>} the value of the option *
26
57
  */
27
58
  getOption(name) {
28
59
  return this.$$options[name];
29
- },
60
+ }
30
61
 
31
62
  /**
32
- * @ngdoc method
33
- * @name ModelOptions#createChild
34
- * @param {Object} options a hash of options for the new child that will override the parent's options
63
+ * @param {ModelOptionsConfig} options a hash of options for the new child that will override the parent's options
35
64
  * @return {ModelOptions} a new `ModelOptions` object initialized with the given options.
36
65
  */
37
66
  createChild(options) {
38
67
  let inheritAll = false;
39
68
 
40
69
  // make a shallow copy
41
- options = extend({}, options);
70
+ options = Object.assign({}, options);
42
71
 
43
72
  // Inherit options from the parent if specified by the value `"$inherit"`
44
73
  forEach(
@@ -79,416 +108,22 @@ ModelOptions.prototype = {
79
108
  defaults(options, defaultModelOptions.$$options);
80
109
 
81
110
  return new ModelOptions(options);
82
- },
83
- };
111
+ }
112
+ }
84
113
 
85
- defaultModelOptions = new ModelOptions({
114
+ export const defaultModelOptions = new ModelOptions({
86
115
  updateOn: "",
87
116
  updateOnDefault: true,
88
117
  debounce: 0,
89
118
  getterSetter: false,
90
119
  allowInvalid: false,
91
- timezone: null,
120
+ //timezone: null,
92
121
  });
93
122
 
94
123
  /**
95
- * @ngdoc directive
96
- * @name ngModelOptions
97
- * @restrict A
98
- * @priority 10
99
- *
100
- * @description
101
- * This directive allows you to modify the behaviour of {@link ngModel} directives within your
102
- * application. You can specify an `ngModelOptions` directive on any element. All {@link ngModel}
103
- * directives will use the options of their nearest `ngModelOptions` ancestor.
104
- *
105
- * The `ngModelOptions` settings are found by evaluating the value of the attribute directive as
106
- * an AngularJS expression. This expression should evaluate to an object, whose properties contain
107
- * the settings. For example: `<div ng-model-options="{ debounce: 100 }"`.
108
- *
109
- * ## Inheriting Options
110
- *
111
- * You can specify that an `ngModelOptions` setting should be inherited from a parent `ngModelOptions`
112
- * directive by giving it the value of `"$inherit"`.
113
- * Then it will inherit that setting from the first `ngModelOptions` directive found by traversing up the
114
- * DOM tree. If there is no ancestor element containing an `ngModelOptions` directive then default settings
115
- * will be used.
116
- *
117
- * For example given the following fragment of HTML
118
- *
119
- *
120
- * ```html
121
- * <div ng-model-options="{ allowInvalid: true, debounce: 200 }">
122
- * <form ng-model-options="{ updateOn: 'blur', allowInvalid: '$inherit' }">
123
- * <input ng-model-options="{ updateOn: 'default', allowInvalid: '$inherit' }" />
124
- * </form>
125
- * </div>
126
- * ```
127
- *
128
- * the `input` element will have the following settings
129
- *
130
- * ```js
131
- * { allowInvalid: true, updateOn: 'default', debounce: 0 }
132
- * ```
133
- *
134
- * Notice that the `debounce` setting was not inherited and used the default value instead.
135
- *
136
- * You can specify that all undefined settings are automatically inherited from an ancestor by
137
- * including a property with key of `"*"` and value of `"$inherit"`.
138
- *
139
- * For example given the following fragment of HTML
140
- *
141
- *
142
- * ```html
143
- * <div ng-model-options="{ allowInvalid: true, debounce: 200 }">
144
- * <form ng-model-options="{ updateOn: 'blur', "*": '$inherit' }">
145
- * <input ng-model-options="{ updateOn: 'default', "*": '$inherit' }" />
146
- * </form>
147
- * </div>
148
- * ```
149
- *
150
- * the `input` element will have the following settings
151
- *
152
- * ```js
153
- * { allowInvalid: true, updateOn: 'default', debounce: 200 }
154
- * ```
155
- *
156
- * Notice that the `debounce` setting now inherits the value from the outer `<div>` element.
157
- *
158
- * If you are creating a reusable component then you should be careful when using `"*": "$inherit"`
159
- * since you may inadvertently inherit a setting in the future that changes the behavior of your component.
160
- *
161
- *
162
- * ## Triggering and debouncing model updates
163
- *
164
- * The `updateOn` and `debounce` properties allow you to specify a custom list of events that will
165
- * trigger a model update and/or a debouncing delay so that the actual update only takes place when
166
- * a timer expires; this timer will be reset after another change takes place.
167
- *
168
- * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might
169
- * be different from the value in the actual model. This means that if you update the model you
170
- * should also invoke {@link ngModel.NgModelController#$rollbackViewValue} on the relevant input field in
171
- * order to make sure it is synchronized with the model and that any debounced action is canceled.
172
- *
173
- * The easiest way to reference the control's {@link ngModel.NgModelController#$rollbackViewValue}
174
- * method is by making sure the input is placed inside a form that has a `name` attribute. This is
175
- * important because `form` controllers are published to the related scope under the name in their
176
- * `name` attribute.
177
- *
178
- * Any pending changes will take place immediately when an enclosing form is submitted via the
179
- * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
180
- * to have access to the updated model.
181
- *
182
- * ### Overriding immediate updates
183
- *
184
- * The following example shows how to override immediate updates. Changes on the inputs within the
185
- * form will update the model only when the control loses focus (blur event). If `escape` key is
186
- * pressed while the input field is focused, the value is reset to the value in the current model.
187
- *
188
- * ### Debouncing updates
189
- *
190
- * The next example shows how to debounce model changes. Model will be updated only 1 sec after last change.
191
- * If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.
192
- *
193
- * ### Default events, extra triggers, and catch-all debounce values
194
- *
195
- * This example shows the relationship between "default" update events and
196
- * additional `updateOn` triggers.
197
- *
198
- * `default` events are those that are bound to the control, and when fired, update the `$viewValue`
199
- * via {@link ngModel.NgModelController#$setViewValue $setViewValue}. Every event that is not listed
200
- * in `updateOn` is considered a "default" event, since different control types have different
201
- * default events.
202
- *
203
- * The control in this example updates by "default", "click", and "blur", with different `debounce`
204
- * values. You can see that "click" doesn't have an individual `debounce` value -
205
- * therefore it uses the `*` debounce value.
206
- *
207
- * There is also a button that calls {@link ngModel.NgModelController#$setViewValue $setViewValue}
208
- * directly with a "custom" event. Since "custom" is not defined in the `updateOn` list,
209
- * it is considered a "default" event and will update the
210
- * control if "default" is defined in `updateOn`, and will receive the "default" debounce value.
211
- * Note that this is just to illustrate how custom controls would possibly call `$setViewValue`.
212
- *
213
- * You can change the `updateOn` and `debounce` configuration to test different scenarios. This
214
- * is done with {@link ngModel.NgModelController#$overrideModelOptions $overrideModelOptions}.
215
- *
216
- <example name="ngModelOptions-advanced" module="optionsExample">
217
- <file name="index.html">
218
- <model-update-demo></model-update-demo>
219
- </file>
220
- <file name="app.js">
221
- angular.module('optionsExample', [])
222
- .component('modelUpdateDemo', {
223
- templateUrl: 'template.html',
224
- controller: function() {
225
- this.name = 'Chinua';
226
-
227
- this.options = {
228
- updateOn: 'default blur click',
229
- debounce: {
230
- default: 2000,
231
- blur: 0,
232
- '*': 1000
233
- }
234
- };
235
-
236
- this.updateEvents = function() {
237
- let eventList = this.options.updateOn.split(' ');
238
- eventList.push('*');
239
- let events = {};
240
-
241
- for (let i = 0; i < eventList.length; i++) {
242
- events[eventList[i]] = this.options.debounce[eventList[i]];
243
- }
244
-
245
- this.events = events;
246
- };
247
-
248
- this.updateOptions = function() {
249
- let options = angular.extend(this.options, {
250
- updateOn: Object.keys(this.events).join(' ').replace('*', ''),
251
- debounce: this.events
252
- });
253
-
254
- this.form.input.$overrideModelOptions(options);
255
- };
256
-
257
- // Initialize the event form
258
- this.updateEvents();
259
- }
260
- });
261
- </file>
262
- <file name="template.html">
263
- <form name="$ctrl.form">
264
- Input: <input type="text" name="input" ng-model="$ctrl.name" ng-model-options="$ctrl.options" />
265
- </form>
266
- Model: <tt>{{$ctrl.name}}</tt>
267
- <hr>
268
- <button ng-click="$ctrl.form.input.$setViewValue('some value', 'custom')">Trigger setViewValue with 'some value' and 'custom' event</button>
269
-
270
- <hr>
271
- <form ng-submit="$ctrl.updateOptions()">
272
- <b>updateOn</b><br>
273
- <input type="text" ng-model="$ctrl.options.updateOn" ng-change="$ctrl.updateEvents()" ng-model-options="{debounce: 500}">
274
-
275
- <table>
276
- <tr>
277
- <th>Option</th>
278
- <th>Debounce value</th>
279
- </tr>
280
- <tr ng-repeat="(key, value) in $ctrl.events">
281
- <td>{{key}}</td>
282
- <td><input type="number" ng-model="$ctrl.events[key]" /></td>
283
- </tr>
284
- </table>
285
-
286
- <br>
287
- <input type="submit" value="Update options">
288
- </form>
289
- </file>
290
- </example>
291
- *
292
- *
293
- * ## Model updates and validation
294
- *
295
- * The default behaviour in `ngModel` is that the model value is set to `undefined` when the
296
- * validation determines that the value is invalid. By setting the `allowInvalid` property to true,
297
- * the model will still be updated even if the value is invalid.
298
- *
299
- *
300
- * ## Connecting to the scope
301
- *
302
- * By setting the `getterSetter` property to true you are telling ngModel that the `ngModel` expression
303
- * on the scope refers to a "getter/setter" function rather than the value itself.
304
- *
305
- * The following example shows how to bind to getter/setters:
306
- *
307
- * <example name="ngModelOptions-directive-getter-setter" module="getterSetterExample">
308
- * <file name="index.html">
309
- * <div ng-controller="ExampleController">
310
- * <form name="userForm">
311
- * <label>
312
- * Name:
313
- * <input type="text" name="userName"
314
- * ng-model="user.name"
315
- * ng-model-options="{ getterSetter: true }" />
316
- * </label>
317
- * </form>
318
- * <pre>user.name = <span ng-bind="user.name()"></span></pre>
319
- * </div>
320
- * </file>
321
- * <file name="app.js">
322
- * angular.module('getterSetterExample', [])
323
- * .controller('ExampleController', ['$scope', function($scope) {
324
- * let _name = 'Brian';
325
- * $scope.user = {
326
- * name: function(newName) {
327
- * return angular.isDefined(newName) ? (_name = newName) : _name;
328
- * }
329
- * };
330
- * }]);
331
- * </file>
332
- * </example>
333
- *
334
- *
335
- * ## Programmatically changing options
336
- *
337
- * The `ngModelOptions` expression is only evaluated once when the directive is linked; it is not
338
- * watched for changes. However, it is possible to override the options on a single
339
- * {@link ngModel.NgModelController} instance with
340
- * {@link ngModel.NgModelController#$overrideModelOptions `NgModelController#$overrideModelOptions()`}.
341
- * See also the example for
342
- * {@link ngModelOptions#default-events-extra-triggers-and-catch-all-debounce-values
343
- * Default events, extra triggers, and catch-all debounce values}.
344
- *
345
- *
346
- * ## Specifying timezones
347
- *
348
- * You can specify the timezone that date/time input directives expect by providing its name in the
349
- * `timezone` property.
350
- *
351
- *
352
- * ## Formatting the value of `time` and `datetime-local`
353
- *
354
- * With the options `timeSecondsFormat` and `timeStripZeroSeconds` it is possible to adjust the value
355
- * that is displayed in the control. Note that browsers may apply their own formatting
356
- * in the user interface.
357
- *
358
- <example name="ngModelOptions-time-format" module="timeExample">
359
- <file name="index.html">
360
- <time-example></time-example>
361
- </file>
362
- <file name="script.js">
363
- angular.module('timeExample', [])
364
- .component('timeExample', {
365
- templateUrl: 'timeExample.html',
366
- controller: function() {
367
- this.time = new Date(1970, 0, 1, 14, 57, 0);
368
-
369
- this.options = {
370
- timeSecondsFormat: 'ss',
371
- timeStripZeroSeconds: true
372
- };
373
-
374
- this.optionChange = function() {
375
- this.timeForm.timeFormatted.$overrideModelOptions(this.options);
376
- this.time = new Date(this.time);
377
- };
378
- }
379
- });
380
- </file>
381
- <file name="timeExample.html">
382
- <form name="$ctrl.timeForm">
383
- <strong>Default</strong>:
384
- <input type="time" ng-model="$ctrl.time" step="any" /><br>
385
- <strong>With options</strong>:
386
- <input type="time" name="timeFormatted" ng-model="$ctrl.time" step="any" ng-model-options="$ctrl.options" />
387
- <br>
388
-
389
- Options:<br>
390
- <code>timeSecondsFormat</code>:
391
- <input
392
- type="text"
393
- ng-model="$ctrl.options.timeSecondsFormat"
394
- ng-change="$ctrl.optionChange()">
395
- <br>
396
- <code>timeStripZeroSeconds</code>:
397
- <input
398
- type="checkbox"
399
- ng-model="$ctrl.options.timeStripZeroSeconds"
400
- ng-change="$ctrl.optionChange()">
401
- </form>
402
- </file>
403
- * </example>
404
- *
405
- * @param {Object} ngModelOptions options to apply to {@link ngModel} directives on this element and
406
- * and its descendents.
407
- *
408
- * **General options**:
409
- *
410
- * - `updateOn`: string specifying which event should the input be bound to. You can set several
411
- * events using an space delimited list. There is a special event called `default` that
412
- * matches the default events belonging to the control. These are the events that are bound to
413
- * the control, and when fired, update the `$viewValue` via `$setViewValue`.
414
- *
415
- * `ngModelOptions` considers every event that is not listed in `updateOn` a "default" event,
416
- * since different control types use different default events.
417
- *
418
- * See also the section {@link ngModelOptions#triggering-and-debouncing-model-updates
419
- * Triggering and debouncing model updates}.
420
- *
421
- * - `debounce`: integer value which contains the debounce model update value in milliseconds. A
422
- * value of 0 triggers an immediate update. If an object is supplied instead, you can specify a
423
- * custom value for each event. For example:
424
- * ```
425
- * ng-model-options="{
426
- * updateOn: 'default blur',
427
- * debounce: { 'default': 500, 'blur': 0 }
428
- * }"
429
- * ```
430
- * You can use the `*` key to specify a debounce value that applies to all events that are not
431
- * specifically listed. In the following example, `mouseup` would have a debounce delay of 1000:
432
- * ```
433
- * ng-model-options="{
434
- * updateOn: 'default blur mouseup',
435
- * debounce: { 'default': 500, 'blur': 0, '*': 1000 }
436
- * }"
437
- * ```
438
- * - `allowInvalid`: boolean value which indicates that the model can be set with values that did
439
- * not validate correctly instead of the default behavior of setting the model to undefined.
440
- * - `getterSetter`: boolean value which determines whether or not to treat functions bound to
441
- * `ngModel` as getters/setters.
442
- *
443
- *
444
- * **Input-type specific options**:
445
- *
446
- * - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for
447
- * `<input type="date" />`, `<input type="time" />`, ... . It understands UTC/GMT and the
448
- * continental US time zone abbreviations, but for general use, use a time zone offset, for
449
- * example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
450
- * If not specified, the timezone of the browser will be used.
451
- * Note that changing the timezone will have no effect on the current date, and is only applied after
452
- * the next input / model change.
453
- *
454
- * - `timeSecondsFormat`: Defines if the `time` and `datetime-local` types should show seconds and
455
- * milliseconds. The option follows the format string of {@link date date filter}.
456
- * By default, the options is `undefined` which is equal to `'ss.sss'` (seconds and milliseconds).
457
- * The other options are `'ss'` (strips milliseconds), and `''` (empty string), which strips both
458
- * seconds and milliseconds.
459
- * Note that browsers that support `time` and `datetime-local` require the hour and minutes
460
- * part of the time string, and may show the value differently in the user interface.
461
- * {@link ngModelOptions#formatting-the-value-of-time-and-datetime-local- See the example}.
462
- *
463
- * - `timeStripZeroSeconds`: Defines if the `time` and `datetime-local` types should strip the
464
- * seconds and milliseconds from the formatted value if they are zero. This option is applied
465
- * after `timeSecondsFormat`.
466
- * This option can be used to make the formatting consistent over different browsers, as some
467
- * browsers with support for `time` will natively hide the milliseconds and
468
- * seconds if they are zero, but others won't, and browsers that don't implement these input
469
- * types will always show the full string.
470
- * {@link ngModelOptions#formatting-the-value-of-time-and-datetime-local- See the example}.
471
- *
124
+ * @returns {import('../../types').Directive}
472
125
  */
473
126
  export const ngModelOptionsDirective = function () {
474
- NgModelOptionsController.$inject = ["$attrs", "$scope"];
475
- function NgModelOptionsController($attrs, $scope) {
476
- this.$$attrs = $attrs;
477
- this.$$scope = $scope;
478
- }
479
- NgModelOptionsController.prototype = {
480
- $onInit() {
481
- const parentOptions = this.parentCtrl
482
- ? this.parentCtrl.$options
483
- : defaultModelOptions;
484
- const modelOptionsDefinition = this.$$scope.$eval(
485
- this.$$attrs.ngModelOptions,
486
- );
487
-
488
- this.$options = parentOptions.createChild(modelOptionsDefinition);
489
- },
490
- };
491
-
492
127
  return {
493
128
  restrict: "A",
494
129
  // ngModelOptions needs to run before ngModel and input directives
@@ -501,9 +136,9 @@ export const ngModelOptionsDirective = function () {
501
136
 
502
137
  // shallow copy over values from `src` that are not already specified on `dst`
503
138
  function defaults(dst, src) {
504
- forEach(src, (value, key) => {
139
+ Object.keys(src).forEach((key) => {
505
140
  if (!isDefined(dst[key])) {
506
- dst[key] = value;
141
+ dst[key] = src[key];
507
142
  }
508
143
  });
509
144
  }