@angular-wave/angular.ts 0.0.67 → 0.0.68

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.
@@ -0,0 +1,114 @@
1
+ /\*\*
2
+
3
+ - The $location service parses the URL in the browser address bar (based on the
4
+ - [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL
5
+ - available to your application. Changes to the URL in the address bar are reflected into
6
+ - $location service and changes to $location are reflected into the browser address bar.
7
+ -
8
+ - **The $location service:**
9
+ -
10
+ - - Exposes the current URL in the browser address bar, so you can
11
+ - - Watch and observe the URL.
12
+ - - Change the URL.
13
+ - - Synchronizes the URL with the browser when the user
14
+ - - Changes the address bar.
15
+ - - Clicks the back or forward button (or clicks a History link).
16
+ - - Clicks on a link.
17
+ - - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
18
+ -
19
+ - For more information see {@link guide/$location Developer Guide: Using $location}
20
+ \*/
21
+
22
+ /\*\*
23
+
24
+ - Use the `$locationProvider` to configure how the application deep linking paths are stored.
25
+ \*/
26
+
27
+ /\*\*
28
+
29
+ - @ngdoc event
30
+ - @name $location#$locationChangeStart
31
+ - @eventType broadcast on root scope
32
+ - @description
33
+ - Broadcasted before a URL will change.
34
+ -
35
+ - This change can be prevented by calling
36
+ - `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more
37
+ - details about event object. Upon successful change
38
+ - {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.
39
+ -
40
+ - The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
41
+ - the browser supports the HTML5 History API.
42
+ -
43
+ - @param {Object} angularEvent Synthetic event object.
44
+ - @param {string} newUrl New URL
45
+ - @param {string=} oldUrl URL that was before it was changed.
46
+ - @param {string=} newState New history state object
47
+ - @param {string=} oldState History state object that was before it was changed.
48
+ \*/
49
+
50
+ /\*\*
51
+
52
+ - @ngdoc event
53
+ - @name $location#$locationChangeSuccess
54
+ - @eventType broadcast on root scope
55
+ - @description
56
+ - Broadcasted after a URL was changed.
57
+ -
58
+ - The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
59
+ - the browser supports the HTML5 History API.
60
+ -
61
+ - @param {Object} angularEvent Synthetic event object.
62
+ - @param {string} newUrl New URL
63
+ - @param {string=} oldUrl URL that was before it was changed.
64
+ - @param {string=} newState New history state object
65
+ - @param {string=} oldState History state object that was before it was changed.
66
+ \*/
67
+
68
+ /\*\*
69
+
70
+ - This method is getter / setter.
71
+ -
72
+ - Return search part (as object) of current URL when called without any parameter.
73
+ -
74
+ - Change search part when called with parameter and return `$location`.
75
+ -
76
+ -
77
+ - ```js
78
+
79
+ ```
80
+
81
+ - // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
82
+ - let searchObject = $location.search();
83
+ - // => {foo: 'bar', baz: 'xoxo'}
84
+ -
85
+ - // set foo to 'yipee'
86
+ - $location.search('foo', 'yipee');
87
+ - // $location.search() => {foo: 'yipee', baz: 'xoxo'}
88
+ - ```
89
+
90
+ ```
91
+
92
+ -
93
+ - @param {string|Object} search New search params - string or hash object.
94
+ -
95
+ - When called with a single argument the method acts as a setter, setting the `search` component
96
+ - of `$location` to the specified value.
97
+ -
98
+ - If the argument is a hash object containing an array of values, these values will be encoded
99
+ - as duplicate search parameters in the URL.
100
+ -
101
+ - @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`
102
+ - will override only a single search property.
103
+ -
104
+ - If `paramValue` is an array, it will override the property of the `search` component of
105
+ - `$location` specified via the first argument.
106
+ -
107
+ - If `paramValue` is `null`, the property specified via the first argument will be deleted.
108
+ -
109
+ - If `paramValue` is `true`, the property specified via the first argument will be added with no
110
+ - value nor trailing equal sign.
111
+ -
112
+ - @return {Object} If called with no arguments returns the parsed `search` object. If called with
113
+ - one or more arguments returns `$location` object itself.
114
+ \*/
@@ -2,7 +2,6 @@ import {
2
2
  LocationHtml5Url,
3
3
  LocationHashbangUrl,
4
4
  $LocationProvider,
5
- LocationHashbangInHtml5Url,
6
5
  } from "./location";
7
6
  import { Angular } from "../../loader";
8
7
  import { createInjector } from "../../core/di/injector";
@@ -464,6 +463,7 @@ describe("$location", () => {
464
463
  .hash("abcd")
465
464
  .state({ a: 2 })
466
465
  .search("bar", "baz");
466
+
467
467
  expect(locationUrl.path()).toEqual("/foo");
468
468
  expect(locationUrl.state()).toEqual({ a: 2 });
469
469
  expect(locationUrl.search() && locationUrl.search().bar).toBe("baz");
@@ -3310,81 +3310,6 @@ describe("$location", () => {
3310
3310
  });
3311
3311
  });
3312
3312
 
3313
- describe("LocationHashbangInHtml5Url", () => {
3314
- /* global LocationHashbangInHtml5Url: false */
3315
- let locationUrl;
3316
- let locationIndexUrl;
3317
-
3318
- beforeEach(() => {
3319
- locationUrl = new LocationHashbangInHtml5Url(
3320
- "http://server/pre/",
3321
- "http://server/pre/",
3322
- "#!",
3323
- );
3324
- locationIndexUrl = new LocationHashbangInHtml5Url(
3325
- "http://server/pre/index.html",
3326
- "http://server/pre/",
3327
- "#!",
3328
- );
3329
- });
3330
-
3331
- it("should rewrite URL", () => {
3332
- expect(parseLinkAndReturn(locationUrl, "http://other")).toEqual(
3333
- undefined,
3334
- );
3335
- expect(parseLinkAndReturn(locationUrl, "http://server/pre")).toEqual(
3336
- "http://server/pre/#!",
3337
- );
3338
- expect(parseLinkAndReturn(locationUrl, "http://server/pre/")).toEqual(
3339
- "http://server/pre/#!",
3340
- );
3341
- expect(
3342
- parseLinkAndReturn(locationUrl, "http://server/pre/otherPath"),
3343
- ).toEqual("http://server/pre/#!/otherPath");
3344
- // Note: relies on the previous state!
3345
- expect(
3346
- parseLinkAndReturn(locationUrl, "someIgnoredAbsoluteHref", "#test"),
3347
- ).toEqual("http://server/pre/#!/otherPath#test");
3348
-
3349
- expect(parseLinkAndReturn(locationIndexUrl, "http://server/pre")).toEqual(
3350
- "http://server/pre/index.html#!",
3351
- );
3352
- expect(
3353
- parseLinkAndReturn(locationIndexUrl, "http://server/pre/"),
3354
- ).toEqual(undefined);
3355
- expect(
3356
- parseLinkAndReturn(locationIndexUrl, "http://server/pre/otherPath"),
3357
- ).toEqual("http://server/pre/index.html#!/otherPath");
3358
- // Note: relies on the previous state!
3359
- expect(
3360
- parseLinkAndReturn(
3361
- locationIndexUrl,
3362
- "someIgnoredAbsoluteHref",
3363
- "#test",
3364
- ),
3365
- ).toEqual("http://server/pre/index.html#!/otherPath#test");
3366
- });
3367
-
3368
- it("should throw on url(urlString, stateObject)", () => {
3369
- expectThrowOnStateChange(locationUrl);
3370
- });
3371
-
3372
- // it("should not throw when base path is another domain", () => {
3373
- // initService({ html5Mode: true, hashPrefix: "!", supportHistory: true });
3374
- // inject(
3375
- // initBrowser({
3376
- // url: "http://domain.com/base/",
3377
- // basePath: "http://otherdomain.com/base/",
3378
- // }),
3379
- // ($location) => {
3380
- // expect(() => {
3381
- // $location.absUrl();
3382
- // }).not.toThrow();
3383
- // },
3384
- // );
3385
- // });
3386
- });
3387
-
3388
3313
  // function mockUpBrowser(options) {
3389
3314
  // module(($windowProvider, $browserProvider) => {
3390
3315
  // let browser;
package/src/core/q/q.js CHANGED
@@ -1,49 +1,43 @@
1
+ import {
2
+ forEach,
3
+ minErr,
4
+ isUndefined,
5
+ isFunction,
6
+ isObject,
7
+ isDefined,
8
+ isError,
9
+ toDebugString,
10
+ isPromiseLike,
11
+ } from "../../shared/utils";
12
+
1
13
  /**
2
14
  * @template T
3
- * @typedef {Object} angular.QPromise
15
+ * @typedef {Object} QPromise
4
16
  * @property {function(
5
17
  * ((value: T) => (PromiseLike<never>|PromiseLike<T>|T))|null,
6
18
  * ((reason: any) => (PromiseLike<never>|PromiseLike<T>|T))|null,
7
19
  * ((state: any) => any)
8
- * ): angular.QPromise<T|never>} then - Calls one of the success or error callbacks asynchronously as soon as the result is available.
20
+ * ): QPromise<T|never>} then - Calls one of the success or error callbacks asynchronously as soon as the result is available.
9
21
  * @property {function(
10
- * ((value: T) => (angular.QPromise<never>|angular.QPromise<T>|T))|null,
11
- * ((reason: any) => (angular.QPromise<never>|angular.QPromise<never>|never))|null,
22
+ * ((value: T) => (QPromise<never>|QPromise<T>|T))|null,
23
+ * ((reason: any) => (QPromise<never>|QPromise<never>|never))|null,
12
24
  * ((state: any) => any)
13
- * ): angular.QPromise<T|never>} then - Calls one of the success or error callbacks asynchronously as soon as the result is available.
14
- * @property {function(((reason: any) => (PromiseLike<never>|PromiseLike<T>|T))|null): angular.QPromise<T>|T} catch - Shorthand for promise.then(null, errorCallback).
15
- * @property {function(((reason: any) => (angular.QPromise<never>|angular.QPromise<T>|T))|null): angular.QPromise<T>|T} catch - Shorthand for promise.then(null, errorCallback).
16
- * @property {function(function(): void): angular.QPromise<T>} finally - Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value.
25
+ * ): QPromise<T|never>} then - Calls one of the success or error callbacks asynchronously as soon as the result is available.
26
+ * @property {function(((reason: any) => (PromiseLike<never>|PromiseLike<T>|T))|null): QPromise<T>|T} catch - Shorthand for promise.then(null, errorCallback).
27
+ * @property {function(((reason: any) => (QPromise<never>|QPromise<T>|T))|null): QPromise<T>|T} catch - Shorthand for promise.then(null, errorCallback).
28
+ * @property {function(function(): void): QPromise<T>} finally - Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value.
29
+ * @property {number} [$$intervalId] - Internal id set by the $interval service for callback notifications
17
30
  */
18
31
 
19
32
  /**
20
33
  *@template T
21
- * @typedef {Object} angular.Deferred
22
- * @property {function(T|angular.QPromise<T>): void} resolve - Resolves the promise with a value or another promise.
34
+ * @typedef {Object} Deferred
35
+ * @property {function(T|QPromise<T>): void} resolve - Resolves the promise with a value or another promise.
23
36
  * @property {function(any): void} reject - Rejects the promise with a reason.
24
37
  * @property {function(any): void} notify - Provides a progress notification.
25
- * @property {angular.QPromise<T>} promise - The promise associated with this deferred object.
38
+ * @property {QPromise<T>} promise - The promise associated with this deferred object.
26
39
  */
27
40
 
28
- import {
29
- forEach,
30
- minErr,
31
- isUndefined,
32
- isFunction,
33
- isObject,
34
- isDefined,
35
- isError,
36
- toDebugString,
37
- isPromiseLike,
38
- } from "../../shared/utils";
39
-
40
- /**
41
- * @ngdoc provider
42
- * @name $qProvider
43
- *
44
- *
45
- * @description
46
- */
47
41
  export function $QProvider() {
48
42
  let errorOnUnhandledRejections = true;
49
43
  this.$get = [
@@ -51,14 +45,16 @@ export function $QProvider() {
51
45
  "$exceptionHandler",
52
46
  /**
53
47
  *
54
- * @param {*} $rootScope
48
+ * @param {import('../scope/scope').Scope} $rootScope
55
49
  * @param {import('../exception-handler').ErrorHandler} $exceptionHandler
56
50
  * @returns
57
51
  */
58
52
  function ($rootScope, $exceptionHandler) {
59
53
  return qFactory(
60
54
  (callback) => {
61
- $rootScope.$evalAsync(callback);
55
+ $rootScope.$evalAsync(
56
+ /** @type {function(function):any} */ (callback),
57
+ );
62
58
  },
63
59
  $exceptionHandler,
64
60
  errorOnUnhandledRejections,
@@ -129,11 +125,6 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
129
125
  const checkQueue = [];
130
126
 
131
127
  /**
132
- * @ngdoc method
133
- * @name ng.$q#defer
134
- * @kind function
135
- *
136
- * @description
137
128
  * Creates a `Deferred` object which represents a task which will finish in the future.
138
129
  *
139
130
  * @returns {Deferred} Returns a new instance of deferred.
@@ -156,38 +147,45 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
156
147
  };
157
148
  }
158
149
 
159
- function QPromise() {
160
- this.$$state = { status: 0 };
161
- }
162
-
163
- QPromise.prototype.then = function (onFulfilled, onRejected, progressBack) {
164
- if (
165
- isUndefined(onFulfilled) &&
166
- isUndefined(onRejected) &&
167
- isUndefined(progressBack)
168
- ) {
169
- return this;
150
+ class QPromise {
151
+ constructor() {
152
+ this.$$state = { status: 0 };
170
153
  }
171
- const result = new QPromise();
172
-
173
- this.$$state.pending = this.$$state.pending || [];
174
- this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);
175
- if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);
176
154
 
177
- return result;
178
- };
155
+ then(onFulfilled, onRejected, progressBack) {
156
+ if (
157
+ isUndefined(onFulfilled) &&
158
+ isUndefined(onRejected) &&
159
+ isUndefined(progressBack)
160
+ ) {
161
+ return this;
162
+ }
163
+ const result = new QPromise();
164
+
165
+ this.$$state.pending = this.$$state.pending || [];
166
+ this.$$state.pending.push([
167
+ result,
168
+ onFulfilled,
169
+ onRejected,
170
+ progressBack,
171
+ ]);
172
+ if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);
173
+
174
+ return result;
175
+ }
179
176
 
180
- QPromise.prototype.catch = function (callback) {
181
- return this.then(null, callback);
182
- };
177
+ catch(callback) {
178
+ return this.then(null, callback);
179
+ }
183
180
 
184
- QPromise.prototype.finally = function (callback, progressBack) {
185
- return this.then(
186
- (value) => handleCallback(value, resolve, callback),
187
- (error) => handleCallback(error, reject, callback),
188
- progressBack,
189
- );
190
- };
181
+ finally(callback, progressBack) {
182
+ return this.then(
183
+ (value) => handleCallback(value, resolve, callback),
184
+ (error) => handleCallback(error, reject, callback),
185
+ progressBack,
186
+ );
187
+ }
188
+ }
191
189
 
192
190
  function processQueue(state) {
193
191
  let fn;
@@ -46,9 +46,7 @@ export const SCE_CONTEXTS = {
46
46
  // http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021
47
47
  // Prereq: s is a string.
48
48
  export function escapeForRegexp(s) {
49
- return s
50
- .replace(/([-()[\]{}+?*.$^|,:#<!\\])/g, "\\$1")
51
- .replace(/\x08/g, "\\x08");
49
+ return s.replace(/([-()[\]{}+?*.$^|,:#<!\\])/g, "\\$1");
52
50
  }
53
51
 
54
52
  export function adjustMatcher(matcher) {
@@ -392,7 +392,7 @@ export class Scope {
392
392
  *
393
393
  * - `string`: Evaluated as {@link guide/expression expression}
394
394
  * - `function(scope)`: called with current `scope` as a parameter.
395
- * @param {WatchListener} listener
395
+ * @param {WatchListener} [listener]
396
396
  * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of
397
397
  * comparing for reference equality.
398
398
  * @returns {function()} Returns a deregistration function for this listener.
@@ -1155,7 +1155,7 @@ export class Scope {
1155
1155
  * will be scheduled. However, it is encouraged to always call code that changes the model
1156
1156
  * from within an `$apply` call. That includes code evaluated via `$evalAsync`.
1157
1157
  *
1158
- * @param {(string|function())=} expr An AngularTS expression to be executed.
1158
+ * @param {(string|function(any):any)=} expr An AngularTS expression to be executed.
1159
1159
  *
1160
1160
  * - `string`: execute using the rules as defined in {@link guide/expression expression}.
1161
1161
  * - `function(scope)`: execute the function with the current `scope` parameter.
@@ -1187,9 +1187,6 @@ export class Scope {
1187
1187
  return id;
1188
1188
  }
1189
1189
 
1190
- /**
1191
- * @private
1192
- */
1193
1190
  $$postDigest(fn) {
1194
1191
  $$postDigestQueue.push(fn);
1195
1192
  }
@@ -1,5 +1,10 @@
1
1
  import { isString } from "../../shared/utils";
2
2
 
3
+ /**
4
+ * HTTP protocol
5
+ * @typedef {"http"|"https"} HttpProtocol
6
+ */
7
+
3
8
  // service.
4
9
  const urlParsingNode = window.document.createElement("a");
5
10
  const originUrl = urlResolve(window.location.href);
@@ -11,161 +11,6 @@ import {
11
11
 
12
12
  const ngOptionsMinErr = minErr("ngOptions");
13
13
 
14
- /**
15
- * @ngdoc directive
16
- * @name ngOptions
17
- * @restrict A
18
- *
19
- * @description
20
- *
21
- * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
22
- * elements for the `<select>` element using the array or object obtained by evaluating the
23
- * `ngOptions` comprehension expression.
24
- *
25
- * In many cases, {@link ng.directive:ngRepeat ngRepeat} can be used on `<option>` elements instead of
26
- * `ngOptions` to achieve a similar result. However, `ngOptions` provides some benefits:
27
- * - more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
28
- * comprehension expression
29
- * - reduced memory consumption by not creating a new scope for each repeated instance
30
- * - increased render speed by creating the options in a documentFragment instead of individually
31
- *
32
- * When an item in the `<select>` menu is selected, the array element or object property
33
- * represented by the selected option will be bound to the model identified by the `ngModel`
34
- * directive.
35
- *
36
- * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
37
- * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
38
- * option. See example below for demonstration.
39
- *
40
- * ## Complex Models (objects or collections)
41
- *
42
- * By default, `ngModel` watches the model by reference, not value. This is important to know when
43
- * binding the select to a model that is an object or a collection.
44
- *
45
- * One issue occurs if you want to preselect an option. For example, if you set
46
- * the model to an object that is equal to an object in your collection, `ngOptions` won't be able to set the selection,
47
- * because the objects are not identical. So by default, you should always reference the item in your collection
48
- * for preselections, e.g.: `$scope.selected = $scope.collection[3]`.
49
- *
50
- * Another solution is to use a `track by` clause, because then `ngOptions` will track the identity
51
- * of the item not by reference, but by the result of the `track by` expression. For example, if your
52
- * collection items have an id property, you would `track by item.id`.
53
- *
54
- * A different issue with objects or collections is that ngModel won't detect if an object property or
55
- * a collection item changes. For that reason, `ngOptions` additionally watches the model using
56
- * `$watchCollection`, when the expression contains a `track by` clause or the the select has the `multiple` attribute.
57
- * This allows ngOptions to trigger a re-rendering of the options even if the actual object/collection
58
- * has not changed identity, but only a property on the object or an item in the collection changes.
59
- *
60
- * Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection
61
- * if the model is an array). This means that changing a property deeper than the first level inside the
62
- * object/collection will not trigger a re-rendering.
63
- *
64
- * ## `select` **`as`**
65
- *
66
- * Using `select` **`as`** will bind the result of the `select` expression to the model, but
67
- * the value of the `<select>` and `<option>` html elements will be either the index (for array data sources)
68
- * or property name (for object data sources) of the value within the collection. If a **`track by`** expression
69
- * is used, the result of that expression will be set as the value of the `option` and `select` elements.
70
- *
71
- *
72
- * ### `select` **`as`** and **`track by`**
73
- *
74
- * <div class="alert alert-warning">
75
- * Be careful when using `select` **`as`** and **`track by`** in the same expression.
76
- * </div>
77
- *
78
- * Given this array of items on the $scope:
79
- *
80
- * ```js
81
- * $scope.items = [{
82
- * id: 1,
83
- * label: 'aLabel',
84
- * subItem: { name: 'aSubItem' }
85
- * }, {
86
- * id: 2,
87
- * label: 'bLabel',
88
- * subItem: { name: 'bSubItem' }
89
- * }];
90
- * ```
91
- *
92
- * This will work:
93
- *
94
- * ```html
95
- * <select ng-options="item as item.label for item in items track by item.id" ng-model="selected"></select>
96
- * ```
97
- * ```js
98
- * $scope.selected = $scope.items[0];
99
- * ```
100
- *
101
- * but this will not work:
102
- *
103
- * ```html
104
- * <select ng-options="item.subItem as item.label for item in items track by item.id" ng-model="selected"></select>
105
- * ```
106
- * ```js
107
- * $scope.selected = $scope.items[0].subItem;
108
- * ```
109
- *
110
- * In both examples, the **`track by`** expression is applied successfully to each `item` in the
111
- * `items` array. Because the selected option has been set programmatically in the controller, the
112
- * **`track by`** expression is also applied to the `ngModel` value. In the first example, the
113
- * `ngModel` value is `items[0]` and the **`track by`** expression evaluates to `items[0].id` with
114
- * no issue. In the second example, the `ngModel` value is `items[0].subItem` and the **`track by`**
115
- * expression evaluates to `items[0].subItem.id` (which is undefined). As a result, the model value
116
- * is not matched against any `<option>` and the `<select>` appears as having no selected value.
117
- *
118
- *
119
- * @param {string} ngModel Assignable AngularJS expression to data-bind to.
120
- * @param {comprehension_expression} ngOptions in one of the following forms:
121
- *
122
- * * for array data sources:
123
- * * `label` **`for`** `value` **`in`** `array`
124
- * * `select` **`as`** `label` **`for`** `value` **`in`** `array`
125
- * * `label` **`group by`** `group` **`for`** `value` **`in`** `array`
126
- * * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array`
127
- * * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
128
- * * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
129
- * * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr`
130
- * (for including a filter with `track by`)
131
- * * for object data sources:
132
- * * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
133
- * * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
134
- * * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`
135
- * * `label` **`disable when`** `disable` **`for (`**`key`**`,`** `value`**`) in`** `object`
136
- * * `select` **`as`** `label` **`group by`** `group`
137
- * **`for` `(`**`key`**`,`** `value`**`) in`** `object`
138
- * * `select` **`as`** `label` **`disable when`** `disable`
139
- * **`for` `(`**`key`**`,`** `value`**`) in`** `object`
140
- *
141
- * Where:
142
- *
143
- * * `array` / `object`: an expression which evaluates to an array / object to iterate over.
144
- * * `value`: local variable which will refer to each item in the `array` or each property value
145
- * of `object` during iteration.
146
- * * `key`: local variable which will refer to a property name in `object` during iteration.
147
- * * `label`: The result of this expression will be the label for `<option>` element. The
148
- * `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).
149
- * * `select`: The result of this expression will be bound to the model of the parent `<select>`
150
- * element. If not specified, `select` expression will default to `value`.
151
- * * `group`: The result of this expression will be used to group options using the `<optgroup>`
152
- * DOM element.
153
- * * `disable`: The result of this expression will be used to disable the rendered `<option>`
154
- * element. Return `true` to disable.
155
- * * `trackexpr`: Used when working with an array of objects. The result of this expression will be
156
- * used to identify the objects in the array. The `trackexpr` will most likely refer to the
157
- * `value` variable (e.g. `value.propertyName`). With this the selection is preserved
158
- * even when the options are recreated (e.g. reloaded from the server).
159
- * @param {string=} name Property name of the form under which the control is published.
160
- * @param {string=} required The control is considered valid only if value is entered.
161
- * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
162
- * the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
163
- * `required` when you want to data-bind to the `required` attribute.
164
- * @param {string=} ngAttrSize sets the size of the select element dynamically. Uses the
165
- * {@link guide/interpolation#-ngattr-for-binding-to-arbitrary-attributes ngAttr} directive.
166
- *
167
- */
168
-
169
14
  const NG_OPTIONS_REGEXP =
170
15
  /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([$\w][$\w]*)|(?:\(\s*([$\w][$\w]*)\s*,\s*([$\w][$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/;
171
16
  // 1: value expression (valueFn)
@@ -618,7 +463,8 @@ export const ngOptionsDirective = [
618
463
 
619
464
  // Update the label on the group element
620
465
  // "null" is special cased because of Safari
621
- groupElement.label =
466
+ /** @type {HTMLOptGroupElement} */
467
+ (groupElement).label =
622
468
  option.group === null ? "null" : option.group;
623
469
 
624
470
  // Store it for use later