@angular-wave/angular.ts 0.0.67 → 0.0.69

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 (87) hide show
  1. package/dist/angular-ts.esm.js +2 -2
  2. package/dist/angular-ts.umd.js +2 -2
  3. package/package.json +1 -1
  4. package/src/animations/animate-swap.js +1 -1
  5. package/src/core/animate/animate.js +5 -5
  6. package/src/core/compile/compile.spec.js +2 -2
  7. package/src/core/controller/controller.js +5 -1
  8. package/src/core/cookie-reader.spec.js +1 -1
  9. package/src/core/di/injector.js +1 -1
  10. package/src/core/di/injector.spec.js +35 -35
  11. package/src/core/di/internal-injector.js +1 -1
  12. package/src/core/filter/filter.spec.js +15 -15
  13. package/src/core/interpolate/interpolate.spec.js +29 -29
  14. package/src/core/interval/interval-factory.js +8 -1
  15. package/src/core/interval/interval.js +30 -16
  16. package/src/core/interval/interval.spec.js +1 -1
  17. package/src/core/location/location.js +473 -626
  18. package/src/core/location/location.md +114 -0
  19. package/src/core/location/location.spec.js +2 -77
  20. package/src/core/parser/lexer.spec.js +1 -1
  21. package/src/core/parser/parse.spec.js +1 -1
  22. package/src/core/q/q.js +64 -65
  23. package/src/core/q/q.spec.js +1 -1
  24. package/src/core/sce/sce.js +1 -3
  25. package/src/core/scope/scope.js +3 -6
  26. package/src/core/timeout/timeout.js +5 -21
  27. package/src/core/url-utils/url-utils.js +5 -0
  28. package/src/directive/attrs/boolean.spec.js +1 -1
  29. package/src/directive/bind/bind.js +2 -2
  30. package/src/directive/class/class.js +1 -1
  31. package/src/directive/form/form.js +1 -18
  32. package/src/directive/form/form.spec.js +2 -2
  33. package/src/directive/include/include.js +7 -0
  34. package/src/directive/input/input.js +1 -1
  35. package/src/{exts → directive}/messages/messages.html +4 -1
  36. package/src/directive/messages/messages.js +346 -0
  37. package/src/{exts → directive}/messages/messages.spec.js +7 -11
  38. package/src/{exts → directive}/messages/messages.test.js +1 -1
  39. package/src/directive/model-options/model-options.spec.js +1 -1
  40. package/src/directive/options/options.js +2 -156
  41. package/src/directive/options/options.md +179 -0
  42. package/src/directive/select/select.js +7 -4
  43. package/src/directive/switch/switch.spec.js +1 -1
  44. package/src/exts/aria/aria.spec.js +1 -1
  45. package/src/filters/filter.js +2 -3
  46. package/src/filters/filter.spec.js +1 -1
  47. package/src/filters/filters.spec.js +1 -1
  48. package/src/filters/limit-to.spec.js +2 -2
  49. package/src/loader.js +1 -1
  50. package/src/loader.spec.js +1 -1
  51. package/src/public.js +12 -2
  52. package/src/router/common/glob.spec.js +1 -1
  53. package/src/router/params/param-factory.js +1 -1
  54. package/src/router/params/param.js +54 -54
  55. package/src/router/path/path-utils.js +1 -0
  56. package/src/router/state/state-builder.spec.js +1 -1
  57. package/src/router/template-factory.js +6 -4
  58. package/src/router/url/url-service.js +7 -0
  59. package/src/router/view/view.spec.js +8 -11
  60. package/src/router/view-scroll.js +6 -1
  61. package/src/services/anchor-scroll.html +83 -0
  62. package/src/services/anchor-scroll.js +25 -10
  63. package/src/services/browser.js +1 -1
  64. package/src/services/http/http.spec.js +40 -40
  65. package/src/shared/jqlite/jqlite.js +4 -4
  66. package/src/shared/jqlite/jqlite.spec.js +4 -4
  67. package/src/shared/utils.js +1 -1
  68. package/types/core/interval/interval-factory.d.ts +1 -1
  69. package/types/core/interval/interval.d.ts +4 -0
  70. package/types/core/location/location.d.ts +235 -166
  71. package/types/core/q/q.d.ts +66 -40
  72. package/types/core/scope/scope.d.ts +5 -8
  73. package/types/core/timeout/timeout.d.ts +3 -7
  74. package/types/core/url-utils/url-utils.d.ts +4 -0
  75. package/types/directive/form/form.d.ts +3 -20
  76. package/types/directive/include/include.d.ts +1 -1
  77. package/types/router/params/param-factory.d.ts +1 -1
  78. package/types/router/params/param.d.ts +11 -0
  79. package/types/router/template-factory.d.ts +4 -4
  80. package/types/router/url/url-service.d.ts +9 -9
  81. package/types/router/view-scroll.d.ts +1 -1
  82. package/types/services/anchor-scroll.d.ts +16 -1
  83. package/types/services/browser.d.ts +2 -2
  84. package/types/shared/jqlite/jqlite.d.ts +2 -2
  85. package/src/exts/messages/messages.js +0 -359
  86. package/types/exts/messages/messages.d.ts +0 -1
  87. /package/src/{exts → directive}/messages/messages.md +0 -0
@@ -49,12 +49,6 @@ export class FormController {
49
49
  */
50
50
  $commitViewValue(): void;
51
51
  /**
52
- * @ngdoc method
53
- * @name form.FormController#$addControl
54
- * @param {object} control control object, either a {@link form.FormController} or an
55
- * {@link ngModel.NgModelController}
56
- *
57
- * @description
58
52
  * Register a control with the form. Input elements using ngModelController do this automatically
59
53
  * when they are linked.
60
54
  *
@@ -69,13 +63,8 @@ export class FormController {
69
63
  * For example, if an input control is added that is already `$dirty` and has `$error` properties,
70
64
  * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form.
71
65
  */
72
- $addControl(control: object): void;
66
+ $addControl(control: any): void;
73
67
  /**
74
- * @ngdoc method
75
- * @name form.FormController#$getControls
76
- * @returns {Array} the controls that are currently part of this form
77
- *
78
- * @description
79
68
  * This method returns a **shallow copy** of the controls that are currently part of this form.
80
69
  * The controls can be instances of {@link form.FormController `FormController`}
81
70
  * ({@link ngForm "child-forms"}) and of {@link ngModel.NgModelController `NgModelController`}.
@@ -90,15 +79,9 @@ export class FormController {
90
79
  * in the shallow copy. That means you should get a fresh copy from `$getControls()` every time
91
80
  * you need access to the controls.
92
81
  */
93
- $getControls(): any[];
82
+ $getControls(): any;
94
83
  $$renameControl(control: any, newName: any): void;
95
84
  /**
96
- * @ngdoc method
97
- * @name form.FormController#$removeControl
98
- * @param {object} control control object, either a {@link form.FormController} or an
99
- * {@link ngModel.NgModelController}
100
- *
101
- * @description
102
85
  * Deregister a control from the form.
103
86
  *
104
87
  * Input elements using ngModelController do this automatically when they are destroyed.
@@ -108,7 +91,7 @@ export class FormController {
108
91
  * different from case to case. For example, removing the only `$dirty` control from a form may or
109
92
  * may not mean that the form is still `$dirty`.
110
93
  */
111
- $removeControl(control: object): void;
94
+ $removeControl(control: any): void;
112
95
  /**
113
96
  * @ngdoc method
114
97
  * @name form.FormController#$setDirty
@@ -1,4 +1,4 @@
1
- export const ngIncludeDirective: (string | (($templateRequest: any, $anchorScroll: any, $animate: any) => {
1
+ export const ngIncludeDirective: (string | (($templateRequest: any, $anchorScroll: import("../../services/anchor-scroll").AnchorScrollFunction, $animate: any) => {
2
2
  restrict: string;
3
3
  priority: number;
4
4
  terminal: boolean;
@@ -5,4 +5,4 @@ export class ParamFactory {
5
5
  fromPath(id: any, type: any, state: any): Param;
6
6
  fromSearch(id: any, type: any, state: any): Param;
7
7
  }
8
- import { Param } from "../params/param";
8
+ import { Param } from "./param";
@@ -25,6 +25,17 @@ export class Param {
25
25
  /** Returns true if a the parameter values are valid, according to the Param definitions */
26
26
  static validates(params: any, values?: {}): any;
27
27
  constructor(id: any, type: any, location: any, urlConfig: any, state: any);
28
+ isOptional: boolean;
29
+ type: any;
30
+ location: any;
31
+ id: any;
32
+ dynamic: boolean;
33
+ raw: boolean;
34
+ squash: any;
35
+ replace: any;
36
+ inherit: boolean;
37
+ array: any;
38
+ config: any;
28
39
  isDefaultValue(value: any): any;
29
40
  /**
30
41
  * [Internal] Gets the decoded representation of a value if the value is defined, otherwise, returns the
@@ -59,20 +59,20 @@ export class TemplateFactory {
59
59
  * Creates a template by invoking an injectable provider function.
60
60
  *
61
61
  * @param {import('../types').Injectable<any>} provider Function to invoke via `locals`
62
- * @param {Function} injectFn a function used to invoke the template provider
62
+ * @param {Function} params a function used to invoke the template provider
63
63
  * @param {import("./resolve/resolve-context").ResolveContext} context
64
64
  * @return {string|Promise.<string>} The template html as a string, or a promise
65
65
  * for that string.
66
66
  */
67
- fromProvider(provider: import("../types").Injectable<any>, params: any, context: import("./resolve/resolve-context").ResolveContext): string | Promise<string>;
67
+ fromProvider(provider: import("../types").Injectable<any>, params: Function, context: import("./resolve/resolve-context").ResolveContext): string | Promise<string>;
68
68
  /**
69
69
  * Creates a component's template by invoking an injectable provider function.
70
70
  *
71
71
  * @param {import('../types').Injectable<any>} provider Function to invoke via `locals`
72
- * @param {Function} injectFn a function used to invoke the template provider
72
+ * @param {Function} params a function used to invoke the template provider
73
73
  * @return {string} The template html as a string: "<component-name input1='::$resolve.foo'></component-name>".
74
74
  */
75
- fromComponentProvider(provider: import("../types").Injectable<any>, params: any, context: any): string;
75
+ fromComponentProvider(provider: import("../types").Injectable<any>, params: Function, context: any): string;
76
76
  /**
77
77
  * Creates a template from a component's name
78
78
  *
@@ -9,8 +9,8 @@ export class UrlService {
9
9
  constructor($locationProvider: import("../../core/location/location").$LocationProvider, stateService: any, globals: any, urlConfigProvider: any);
10
10
  stateService: any;
11
11
  $locationProvider: import("../../core/location/location").$LocationProvider;
12
- $location: any;
13
- $browser: any;
12
+ $location: import("../../core/location/location").Location;
13
+ $browser: import("../../services/browser").Browser;
14
14
  /** @type {boolean} */
15
15
  interceptDeferred: boolean;
16
16
  /** Provides services related to the URL */
@@ -54,12 +54,12 @@ export class UrlService {
54
54
  *
55
55
  * @return the hash (anchor) portion of the url
56
56
  */
57
- hash: () => any;
57
+ hash: () => string | import("../../core/location/location").Location;
58
58
  _urlListeners: any[];
59
- $get: (string | (($location: any, $browser: any, $rootScope: any) => this))[];
59
+ $get: (string | (($location: import("../../core/location/location").Location, $browser: import("../../services/browser").Browser, $rootScope: import("../../core/scope/scope").Scope) => this))[];
60
60
  html5Mode(): boolean;
61
- baseHref(): any;
62
- _baseHref: any;
61
+ baseHref(): string;
62
+ _baseHref: string;
63
63
  /**
64
64
  * Gets the current url, or updates the url
65
65
  *
@@ -112,7 +112,7 @@ export class UrlService {
112
112
  *
113
113
  * @return the url (after potentially being processed)
114
114
  */
115
- url(newUrl?: string, replace?: boolean, state?: any): any;
115
+ url(newUrl?: string, replace?: boolean, state?: any): string | import("../../core/location/location").Location;
116
116
  /**
117
117
  * @internal
118
118
  *
@@ -137,7 +137,7 @@ export class UrlService {
137
137
  parts(): {
138
138
  path: any;
139
139
  search: any;
140
- hash: any;
140
+ hash: string | import("../../core/location/location").Location;
141
141
  };
142
142
  /**
143
143
  * Activates the best rule for the current URL
@@ -218,7 +218,7 @@ export class UrlService {
218
218
  */
219
219
  match(url: any): any;
220
220
  update(read: any): void;
221
- location: any;
221
+ location: string | import("../../core/location/location").Location;
222
222
  /**
223
223
  * Internal API.
224
224
  *
@@ -1,5 +1,5 @@
1
1
  export function $ViewScrollProvider(): void;
2
2
  export class $ViewScrollProvider {
3
3
  useAnchorScroll: () => void;
4
- $get: (string | (($anchorScroll: any, $timeout: any) => any))[];
4
+ $get: (string | (($anchorScroll: import("../services/anchor-scroll").AnchorScrollObject, $timeout: any) => import("../services/anchor-scroll").AnchorScrollObject | Function))[];
5
5
  }
@@ -1,5 +1,20 @@
1
+ /**
2
+ * @typedef {Object} AnchorScrollObject
3
+ * @property {number|function|import("../shared/jqlite/jqlite").JQLite} yOffset
4
+ */
5
+ /**
6
+ * @typedef {(string) => void} AnchorScrollFunction
7
+ */
8
+ /**
9
+ * @typedef {AnchorScrollFunction | AnchorScrollObject} AnchorScrollService
10
+ */
1
11
  export function AnchorScrollProvider(): void;
2
12
  export class AnchorScrollProvider {
3
13
  disableAutoScrolling: () => void;
4
- $get: (string | (($location: any, $rootScope: import("../core/scope/scope").Scope) => (hash: any) => void))[];
14
+ $get: (string | (($location: import("../core/location/location").Location, $rootScope: import("../core/scope/scope").Scope) => AnchorScrollFunction))[];
5
15
  }
16
+ export type AnchorScrollObject = {
17
+ yOffset: number | Function | import("../shared/jqlite/jqlite").JQLite;
18
+ };
19
+ export type AnchorScrollFunction = (string: any) => void;
20
+ export type AnchorScrollService = AnchorScrollFunction | AnchorScrollObject;
@@ -125,7 +125,7 @@ export class Browser {
125
125
  * @param {function():any} fn A function, who's execution should be deferred.
126
126
  * @param {number=} [delay=0] Number of milliseconds to defer the function execution.
127
127
  * @param {string=} [taskType=DEFAULT_TASK_TYPE] The type of task that is deferred.
128
- * @returns {*} DeferId that can be used to cancel the task via `$browser.cancel()`.
128
+ * @returns {number} DeferId that can be used to cancel the task via `$browser.cancel()`.
129
129
  *
130
130
  * @description
131
131
  * Executes a fn asynchronously via `setTimeout(fn, delay)`.
@@ -135,7 +135,7 @@ export class Browser {
135
135
  * via `$browser.defer.flush()`.
136
136
  *
137
137
  */
138
- defer: (fn: () => any, delay?: number | undefined, taskType?: string | undefined) => any;
138
+ defer: (fn: () => any, delay?: number | undefined, taskType?: string | undefined) => number;
139
139
  /**
140
140
  * @name $browser#cancel
141
141
  *
@@ -109,10 +109,10 @@ export class JQLite {
109
109
  */
110
110
  append(node: string | JQLite): JQLite;
111
111
  /**
112
- * @param {string} node
112
+ * @param {string|JQLite} node
113
113
  * @returns {JQLite}
114
114
  */
115
- prepend(node: string): JQLite;
115
+ prepend(node: string | JQLite): JQLite;
116
116
  /**
117
117
  * @param {string} newElement
118
118
  * @returns {JQLite}
@@ -1,359 +0,0 @@
1
- import { forEach, isString } from "../../shared/utils";
2
-
3
- export function initMessageModule(angular) {
4
- angular
5
- .module("ngMessages", [])
6
-
7
- .directive("ngMessages", [
8
- "$animate",
9
- function ($animate) {
10
- const ACTIVE_CLASS = "ng-active";
11
- const INACTIVE_CLASS = "ng-inactive";
12
- return {
13
- require: "ngMessages",
14
- restrict: "AE",
15
- controller: [
16
- "$element",
17
- "$scope",
18
- "$attrs",
19
- function NgMessagesCtrl($element, $scope, $attrs) {
20
- const ctrl = this;
21
- let latestKey = 0;
22
- let nextAttachId = 0;
23
-
24
- this.getAttachId = function getAttachId() {
25
- return nextAttachId++;
26
- };
27
-
28
- const messages = (this.messages = {});
29
- let renderLater;
30
- let cachedCollection;
31
-
32
- this.render = function (collection) {
33
- collection = collection || {};
34
-
35
- renderLater = false;
36
- cachedCollection = collection;
37
-
38
- // this is true if the attribute is empty or if the attribute value is truthy
39
- const multiple =
40
- isAttrTruthy($scope, $attrs.ngMessagesMultiple) ||
41
- isAttrTruthy($scope, $attrs.multiple);
42
-
43
- const unmatchedMessages = [];
44
- const matchedKeys = {};
45
- let truthyKeys = 0;
46
- let messageItem = ctrl.head;
47
- let messageFound = false;
48
- let totalMessages = 0;
49
-
50
- // we use != instead of !== to allow for both undefined and null values
51
- while (messageItem != null) {
52
- totalMessages++;
53
- const messageCtrl = messageItem.message;
54
-
55
- let messageUsed = false;
56
- if (!messageFound) {
57
- forEach(collection, (value, key) => {
58
- if (truthy(value) && !messageUsed) {
59
- truthyKeys++;
60
-
61
- if (messageCtrl.test(key)) {
62
- // this is to prevent the same error name from showing up twice
63
- if (matchedKeys[key]) return;
64
- matchedKeys[key] = true;
65
-
66
- messageUsed = true;
67
- messageCtrl.attach();
68
- }
69
- }
70
- });
71
- }
72
-
73
- if (messageUsed) {
74
- // unless we want to display multiple messages then we should
75
- // set a flag here to avoid displaying the next message in the list
76
- messageFound = !multiple;
77
- } else {
78
- unmatchedMessages.push(messageCtrl);
79
- }
80
-
81
- messageItem = messageItem.next;
82
- }
83
-
84
- forEach(unmatchedMessages, (messageCtrl) => {
85
- messageCtrl.detach();
86
- });
87
-
88
- const messageMatched =
89
- unmatchedMessages.length !== totalMessages;
90
- const attachDefault =
91
- ctrl.default && !messageMatched && truthyKeys > 0;
92
-
93
- if (attachDefault) {
94
- ctrl.default.attach();
95
- } else if (ctrl.default) {
96
- ctrl.default.detach();
97
- }
98
-
99
- if (messageMatched || attachDefault) {
100
- $animate.setClass($element, ACTIVE_CLASS, INACTIVE_CLASS);
101
- } else {
102
- $animate.setClass($element, INACTIVE_CLASS, ACTIVE_CLASS);
103
- }
104
- };
105
-
106
- $scope.$watchCollection(
107
- $attrs.ngMessages || $attrs.for,
108
- ctrl.render,
109
- );
110
-
111
- this.reRender = function () {
112
- if (!renderLater) {
113
- renderLater = true;
114
- $scope.$evalAsync(() => {
115
- if (renderLater && cachedCollection) {
116
- ctrl.render(cachedCollection);
117
- }
118
- });
119
- }
120
- };
121
-
122
- this.register = function (comment, messageCtrl, isDefault) {
123
- if (isDefault) {
124
- ctrl.default = messageCtrl;
125
- } else {
126
- const nextKey = latestKey.toString();
127
- messages[nextKey] = {
128
- message: messageCtrl,
129
- };
130
- insertMessageNode($element[0], comment, nextKey);
131
- comment.$$ngMessageNode = nextKey;
132
- latestKey++;
133
- }
134
-
135
- ctrl.reRender();
136
- };
137
-
138
- this.deregister = function (comment, isDefault) {
139
- if (isDefault) {
140
- delete ctrl.default;
141
- } else {
142
- const key = comment.$$ngMessageNode;
143
- delete comment.$$ngMessageNode;
144
- removeMessageNode($element[0], comment, key);
145
- delete messages[key];
146
- }
147
- ctrl.reRender();
148
- };
149
-
150
- function findPreviousMessage(parent, comment) {
151
- let prevNode = comment;
152
- const parentLookup = [];
153
-
154
- while (prevNode && prevNode !== parent) {
155
- const prevKey = prevNode.$$ngMessageNode;
156
- if (prevKey && prevKey.length) {
157
- return messages[prevKey];
158
- }
159
-
160
- // dive deeper into the DOM and examine its children for any ngMessage
161
- // comments that may be in an element that appears deeper in the list
162
- if (
163
- prevNode.childNodes.length &&
164
- parentLookup.indexOf(prevNode) === -1
165
- ) {
166
- parentLookup.push(prevNode);
167
- prevNode =
168
- prevNode.childNodes[prevNode.childNodes.length - 1];
169
- } else if (prevNode.previousSibling) {
170
- prevNode = prevNode.previousSibling;
171
- } else {
172
- prevNode = prevNode.parentNode;
173
- parentLookup.push(prevNode);
174
- }
175
- }
176
- }
177
-
178
- function insertMessageNode(parent, comment, key) {
179
- const messageNode = messages[key];
180
- if (!ctrl.head) {
181
- ctrl.head = messageNode;
182
- } else {
183
- const match = findPreviousMessage(parent, comment);
184
- if (match) {
185
- messageNode.next = match.next;
186
- match.next = messageNode;
187
- } else {
188
- messageNode.next = ctrl.head;
189
- ctrl.head = messageNode;
190
- }
191
- }
192
- }
193
-
194
- function removeMessageNode(parent, comment, key) {
195
- const messageNode = messages[key];
196
-
197
- // This message node may have already been removed by a call to deregister()
198
- if (!messageNode) return;
199
-
200
- const match = findPreviousMessage(parent, comment);
201
- if (match) {
202
- match.next = messageNode.next;
203
- } else {
204
- ctrl.head = messageNode.next;
205
- }
206
- }
207
- },
208
- ],
209
- };
210
-
211
- function isAttrTruthy(scope, attr) {
212
- return (
213
- (isString(attr) && attr.length === 0) || // empty attribute
214
- truthy(scope.$eval(attr))
215
- );
216
- }
217
-
218
- function truthy(val) {
219
- return isString(val) ? val.length : !!val;
220
- }
221
- },
222
- ])
223
-
224
- .directive("ngMessagesInclude", [
225
- "$templateRequest",
226
- "$compile",
227
- function ($templateRequest, $compile) {
228
- return {
229
- restrict: "AE",
230
- require: "^^ngMessages", // we only require this for validation sake
231
- link($scope, element, attrs) {
232
- const src = attrs.ngMessagesInclude || attrs.src;
233
- $templateRequest(src).then((html) => {
234
- if ($scope.$$destroyed) return;
235
- if (isString(html) && !html.trim()) {
236
- // Empty template - nothing to compile
237
- } else {
238
- // Non-empty template - compile and link
239
- $compile(html)($scope, (contents) => {
240
- element.after(contents);
241
- });
242
- }
243
- });
244
- },
245
- };
246
- },
247
- ])
248
-
249
- .directive("ngMessage", ngMessageDirectiveFactory(false))
250
- .directive("ngMessageExp", ngMessageDirectiveFactory(false))
251
- .directive("ngMessageDefault", ngMessageDirectiveFactory(true));
252
-
253
- function ngMessageDirectiveFactory(isDefault) {
254
- return [
255
- "$animate",
256
- function ($animate) {
257
- return {
258
- restrict: "AE",
259
- transclude: "element",
260
- priority: 1, // must run before ngBind, otherwise the text is set on the comment
261
- terminal: true,
262
- require: "^^ngMessages",
263
- link(scope, element, attrs, ngMessagesCtrl, $transclude) {
264
- let commentNode;
265
- let records;
266
- let staticExp;
267
- let dynamicExp;
268
-
269
- if (!isDefault) {
270
- commentNode = element[0];
271
- staticExp = attrs.ngMessage || attrs.when;
272
- dynamicExp = attrs.ngMessageExp || attrs.whenExp;
273
-
274
- const assignRecords = function (items) {
275
- records = items
276
- ? Array.isArray(items)
277
- ? items
278
- : items.split(/[\s,]+/)
279
- : null;
280
- ngMessagesCtrl.reRender();
281
- };
282
-
283
- if (dynamicExp) {
284
- assignRecords(scope.$eval(dynamicExp));
285
- scope.$watchCollection(dynamicExp, assignRecords);
286
- } else {
287
- assignRecords(staticExp);
288
- }
289
- }
290
-
291
- let currentElement;
292
- let messageCtrl;
293
- ngMessagesCtrl.register(
294
- commentNode,
295
- (messageCtrl = {
296
- test(name) {
297
- return contains(records, name);
298
- },
299
- attach() {
300
- if (!currentElement) {
301
- $transclude((elm, newScope) => {
302
- $animate.enter(elm, null, element);
303
- currentElement = elm;
304
-
305
- // Each time we attach this node to a message we get a new id that we can match
306
- // when we are destroying the node later.
307
- const $$attachId = (currentElement.$$attachId =
308
- ngMessagesCtrl.getAttachId());
309
-
310
- // in the event that the element or a parent element is destroyed
311
- // by another structural directive then it's time
312
- // to deregister the message from the controller
313
- currentElement.on("$destroy", () => {
314
- // If the message element was removed via a call to `detach` then `currentElement` will be null
315
- // So this handler only handles cases where something else removed the message element.
316
- if (
317
- currentElement &&
318
- currentElement.$$attachId === $$attachId
319
- ) {
320
- ngMessagesCtrl.deregister(commentNode, isDefault);
321
- messageCtrl.detach();
322
- }
323
- newScope.$destroy();
324
- });
325
- });
326
- }
327
- },
328
- detach() {
329
- if (currentElement) {
330
- const elm = currentElement;
331
- currentElement = null;
332
- $animate.leave(elm);
333
- }
334
- },
335
- }),
336
- isDefault,
337
- );
338
-
339
- // We need to ensure that this directive deregisters itself when it no longer exists
340
- // Normally this is done when the attached element is destroyed; but if this directive
341
- // gets removed before we attach the message to the DOM there is nothing to watch
342
- // in which case we must deregister when the containing scope is destroyed.
343
- scope.$on("$destroy", () => {
344
- ngMessagesCtrl.deregister(commentNode, isDefault);
345
- });
346
- },
347
- };
348
- },
349
- ];
350
-
351
- function contains(collection, key) {
352
- if (collection) {
353
- return Array.isArray(collection)
354
- ? collection.indexOf(key) >= 0
355
- : Object.prototype.hasOwnProperty.call(collection, key);
356
- }
357
- }
358
- }
359
- }
@@ -1 +0,0 @@
1
- export function initMessageModule(angular: any): void;
File without changes