@angular-wave/angular.ts 0.6.4 → 0.6.6
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.
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +2 -1
- package/src/animations/animate-js.js +1 -1
- package/src/animations/animation.js +1 -1
- package/src/core/compile/attributes.js +21 -4
- package/src/core/compile/compile.js +66 -109
- package/src/core/compile/compile.spec.js +14 -13
- package/src/core/controller/controller.js +1 -1
- package/src/core/di/internal-injector.js +1 -1
- package/src/core/exception-handler.js +14 -12
- package/src/core/filter/filter.js +1 -1
- package/src/core/q/q.js +1 -1
- package/src/core/sce/sce.js +1 -1
- package/src/core/scope/scope.js +2 -2
- package/src/core/timeout/timeout.js +1 -1
- package/src/directive/bind/{bing-html.spec.js → bind-html.spec.js} +0 -1
- package/src/directive/bind/bind.html +1 -0
- package/src/directive/channel/channel.js +25 -7
- package/src/directive/channel/channel.spec.js +17 -0
- package/src/directive/events/events.js +1 -1
- package/src/directive/model/model.js +1 -1
- package/src/directive/options/options.spec.js +60 -54
- package/src/directive/setter/setter.js +18 -3
- package/src/directive/setter/setter.spec.js +29 -8
- package/src/loader.js +4 -13
- package/src/router/common/coreservices.js +1 -1
- package/src/router/state/state-registry.js +1 -1
- package/src/router/template-factory.js +8 -7
- package/src/router/url/url-matcher.js +1 -1
- package/src/services/http/http.js +1 -1
- package/src/services/template-request.js +1 -1
- package/types/animations/animate-js.d.ts +1 -1
- package/types/animations/animation.d.ts +1 -1
- package/types/core/compile/compile.d.ts +2 -1
- package/types/core/controller/controller.d.ts +1 -1
- package/types/core/filter/filter.d.ts +1 -1
- package/types/core/q/q.d.ts +1 -1
- package/types/core/sce/sce.d.ts +1 -1
- package/types/core/scope/scope.d.ts +1 -1
- package/types/core/timeout/timeout.d.ts +1 -1
- package/types/directive/channel/channel.d.ts +13 -4
- package/types/directive/model/model.d.ts +8 -8
- package/types/directive/repeat/repeat.d.ts +10 -7
- package/types/loader.d.ts +4 -7
- package/types/router/common/coreservices.d.ts +1 -1
- package/types/router/state/state-registry.d.ts +2 -2
- package/types/router/template-factory.d.ts +2 -2
- package/types/services/http/http.d.ts +1 -1
- package/types/services/template-request.d.ts +1 -1
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<script src="/jasmine/jasmine-5.1.2/boot0.js"></script>
|
|
12
12
|
<script src="/jasmine/jasmine-5.1.2/boot1.js"></script>
|
|
13
13
|
<script type="module" src="/src/directive/bind/bind.spec.js"></script>
|
|
14
|
+
<script type="module" src="/src/directive/bind/bind-html.spec.js"></script>
|
|
14
15
|
</head>
|
|
15
16
|
<body>
|
|
16
17
|
<div id="dummy"></div>
|
|
@@ -1,24 +1,42 @@
|
|
|
1
|
-
import { EventBus } from "../../core/pubsub/pubsub";
|
|
1
|
+
import { EventBus } from "../../core/pubsub/pubsub.js";
|
|
2
|
+
import { isObject } from "../../shared/utils.js";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Dynamically updates an element's content based on events published on a specified channel.
|
|
5
|
-
*
|
|
6
|
-
*
|
|
6
|
+
* If data is sent via `EventBus` on the specified `ngChannel`, the directive attempts to update the element's content accordingly,
|
|
7
|
+
* either by directly setting the inner HTML or merging the scope's data if the element contains a template.
|
|
8
|
+
*
|
|
9
|
+
* If the element has a template and incoming data is an object, the directive will merge all key/value pairs onto the scope,
|
|
10
|
+
* allowing Angular expressions (`{{ yourModel }}`) to be evaluated and rendered.
|
|
7
11
|
*
|
|
8
12
|
* When the scope is destroyed, the directive automatically unsubscribes from the channel.
|
|
13
|
+
* Example:
|
|
14
|
+
*
|
|
15
|
+
* HTML:
|
|
16
|
+
* <div ng-channel="userChannel">Hello {{ user.firstName }} {{ user.lastName }}</div>
|
|
9
17
|
*
|
|
18
|
+
* JavaScript:
|
|
19
|
+
* angular.EventBus.publish('userChannel', { user: { firstName: 'John', lastName: 'Smith' } });
|
|
10
20
|
*
|
|
11
|
-
* @returns {import("../../types").Directive}
|
|
21
|
+
* @returns {import("../../types.js").Directive}
|
|
12
22
|
*/
|
|
13
23
|
export function ngChannelDirective() {
|
|
14
24
|
return {
|
|
15
25
|
restrict: "EA",
|
|
16
26
|
link: (scope, element, attrs) => {
|
|
17
|
-
const
|
|
27
|
+
const hasTemplate = element[0].childNodes.length > 0;
|
|
18
28
|
const channel = attrs["ngChannel"];
|
|
19
29
|
|
|
20
|
-
const key = EventBus.subscribe(channel, (val) => {
|
|
21
|
-
|
|
30
|
+
const key = EventBus.subscribe(channel, async (val) => {
|
|
31
|
+
if (!hasTemplate) {
|
|
32
|
+
element[0].innerHTML = val;
|
|
33
|
+
} else {
|
|
34
|
+
if (isObject(val)) {
|
|
35
|
+
Object.entries(val).forEach(([key, value]) => {
|
|
36
|
+
scope[key] = value;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
}
|
|
22
40
|
});
|
|
23
41
|
|
|
24
42
|
scope.$on("$destroy", () => {
|
|
@@ -49,4 +49,21 @@ describe("channel", () => {
|
|
|
49
49
|
|
|
50
50
|
expect(unsubscribeSpy).toHaveBeenCalled();
|
|
51
51
|
});
|
|
52
|
+
|
|
53
|
+
it("should handle templates when EventBus emits a value", async () => {
|
|
54
|
+
element = $compile(
|
|
55
|
+
'<div ng-channel="testChannel">{{ a.firstName }} {{ a.lastName }}</div>',
|
|
56
|
+
)($scope);
|
|
57
|
+
$scope.$digest();
|
|
58
|
+
expect(element[0].textContent).toBe(" ");
|
|
59
|
+
|
|
60
|
+
EventBus.publish("testChannel", {
|
|
61
|
+
a: { firstName: "John", lastName: "Doe" },
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
await wait(100);
|
|
65
|
+
$scope.$digest();
|
|
66
|
+
|
|
67
|
+
expect(element[0].textContent).toBe("John Doe");
|
|
68
|
+
});
|
|
52
69
|
});
|
|
@@ -27,7 +27,7 @@ const forceAsyncEvents = {
|
|
|
27
27
|
*
|
|
28
28
|
* @param {*} $parse
|
|
29
29
|
* @param {*} $rootScope
|
|
30
|
-
* @param {import('../../core/exception-handler').ErrorHandler} $exceptionHandler
|
|
30
|
+
* @param {import('../../core/exception-handler.js').ErrorHandler} $exceptionHandler
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
33
33
|
($parse, $rootScope, $exceptionHandler) => {
|
|
@@ -83,7 +83,7 @@ export class NgModelController {
|
|
|
83
83
|
|
|
84
84
|
/**
|
|
85
85
|
* @param {import('../../core/scope/scope').Scope} $scope
|
|
86
|
-
* @param {import('../../core/exception-handler').ErrorHandler} $exceptionHandler
|
|
86
|
+
* @param {import('../../core/exception-handler.js').ErrorHandler} $exceptionHandler
|
|
87
87
|
* @param {import('../../core/compile/attributes').Attributes} $attr
|
|
88
88
|
* @param {import('../../shared/jqlite/jqlite').JQLite} $element
|
|
89
89
|
* @param {import("../../core/parse/parse.js").ParseService} $parse
|
|
@@ -159,65 +159,71 @@ describe("ngOptions", () => {
|
|
|
159
159
|
beforeEach(() => {
|
|
160
160
|
window.angular = new Angular();
|
|
161
161
|
window.angular
|
|
162
|
-
.module("myModule", [
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
},
|
|
181
|
-
templateUrl: "select_template.html",
|
|
182
|
-
link(scope, $element, attributes) {
|
|
183
|
-
scope.selectable_options = scope.options;
|
|
184
|
-
},
|
|
185
|
-
}))
|
|
162
|
+
.module("myModule", [
|
|
163
|
+
"ng",
|
|
164
|
+
($compileProvider, $provide) => {
|
|
165
|
+
linkLog = [];
|
|
166
|
+
|
|
167
|
+
$compileProvider
|
|
168
|
+
.directive("customSelect", () => ({
|
|
169
|
+
restrict: "E",
|
|
170
|
+
replace: true,
|
|
171
|
+
scope: {
|
|
172
|
+
ngModel: "=",
|
|
173
|
+
options: "=",
|
|
174
|
+
},
|
|
175
|
+
templateUrl: "select_template.html",
|
|
176
|
+
link(scope, $element, attributes) {
|
|
177
|
+
scope.selectable_options = scope.options;
|
|
178
|
+
},
|
|
179
|
+
}))
|
|
186
180
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
181
|
+
.directive("oCompileContents", () => ({
|
|
182
|
+
link(scope, element) {
|
|
183
|
+
linkLog.push("linkCompileContents");
|
|
184
|
+
$compile(JQLite(element[0].childNodes))(scope);
|
|
185
|
+
},
|
|
186
|
+
}))
|
|
193
187
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
188
|
+
.directive("observeChildList", () => ({
|
|
189
|
+
link(scope, element) {
|
|
190
|
+
const config = { childList: true };
|
|
197
191
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
$provide.decorator("ngOptionsDirective", ($delegate) => {
|
|
204
|
-
const origPreLink = $delegate[0].link.pre;
|
|
205
|
-
const origPostLink = $delegate[0].link.post;
|
|
206
|
-
|
|
207
|
-
$delegate[0].compile = function () {
|
|
208
|
-
return {
|
|
209
|
-
pre: origPreLink,
|
|
210
|
-
post() {
|
|
211
|
-
linkLog.push("linkNgOptions");
|
|
212
|
-
origPostLink.apply(this, arguments);
|
|
192
|
+
childListMutationObserver = new window.MutationObserver(
|
|
193
|
+
() => {},
|
|
194
|
+
);
|
|
195
|
+
childListMutationObserver.observe(element[0], config);
|
|
213
196
|
},
|
|
197
|
+
}));
|
|
198
|
+
|
|
199
|
+
$provide.decorator("ngOptionsDirective", ($delegate) => {
|
|
200
|
+
const origPreLink = $delegate[0].link.pre;
|
|
201
|
+
const origPostLink = $delegate[0].link.post;
|
|
202
|
+
|
|
203
|
+
$delegate[0].compile = function () {
|
|
204
|
+
return {
|
|
205
|
+
pre: origPreLink,
|
|
206
|
+
post() {
|
|
207
|
+
linkLog.push("linkNgOptions");
|
|
208
|
+
origPostLink.apply(this, arguments);
|
|
209
|
+
},
|
|
210
|
+
};
|
|
214
211
|
};
|
|
215
|
-
};
|
|
216
212
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
213
|
+
return $delegate;
|
|
214
|
+
});
|
|
215
|
+
},
|
|
216
|
+
])
|
|
217
|
+
.decorator("$exceptionHandler", function () {
|
|
218
|
+
return (exception, cause) => {
|
|
219
|
+
throw new Error(exception.message);
|
|
220
|
+
};
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
224
|
+
"myModule",
|
|
220
225
|
]);
|
|
226
|
+
|
|
221
227
|
$compile = injector.get("$compile");
|
|
222
228
|
scope = injector.get("$rootScope").$new(); // create a child scope because the root scope can't be $destroy-ed
|
|
223
229
|
formElement = element = null;
|
|
@@ -2992,7 +2998,7 @@ describe("ngOptions", () => {
|
|
|
2992
2998
|
const addSpiesOnProto =
|
|
2993
2999
|
originalSelectedDescriptor && originalSelectedDescriptor.configurable;
|
|
2994
3000
|
|
|
2995
|
-
|
|
3001
|
+
options.elements().forEach((option, i) => {
|
|
2996
3002
|
const setSelected = function (value) {
|
|
2997
3003
|
_selected[i] = value;
|
|
2998
3004
|
};
|
|
@@ -3003,7 +3009,7 @@ describe("ngOptions", () => {
|
|
|
3003
3009
|
});
|
|
3004
3010
|
|
|
3005
3011
|
if (!addSpiesOnProto) {
|
|
3006
|
-
|
|
3012
|
+
options.elements().forEach((option, i) => {
|
|
3007
3013
|
Object.defineProperty(option, "selected", {
|
|
3008
3014
|
get() {
|
|
3009
3015
|
return _selected[i];
|
|
@@ -21,8 +21,11 @@ export function ngSetterDirective($parse) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const updateModel = (value) => {
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
if (value !== "") {
|
|
25
|
+
const maybeNumber = convertToNumberOrString(value);
|
|
26
|
+
assignModel(scope, maybeNumber);
|
|
27
|
+
scope.$digest();
|
|
28
|
+
}
|
|
26
29
|
};
|
|
27
30
|
|
|
28
31
|
const observer = new MutationObserver((mutationsList) => {
|
|
@@ -54,7 +57,19 @@ export function ngSetterDirective($parse) {
|
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
scope.$on("$destroy", () => observer.disconnect());
|
|
57
|
-
|
|
60
|
+
const content = element.html();
|
|
61
|
+
updateModel(content);
|
|
58
62
|
},
|
|
59
63
|
};
|
|
60
64
|
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Converts the input to a number if possible, otherwise returns the input as a string.
|
|
68
|
+
*
|
|
69
|
+
* @param {string} input - The input to be converted or returned.
|
|
70
|
+
* @returns {number|string} The converted number if valid, or the original string if not convertible.
|
|
71
|
+
*/
|
|
72
|
+
function convertToNumberOrString(input) {
|
|
73
|
+
const converted = Number(input);
|
|
74
|
+
return isNaN(converted) ? input : converted;
|
|
75
|
+
}
|
|
@@ -21,7 +21,6 @@ describe("setter", () => {
|
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
it("should update the scope model when the element content changes", async () => {
|
|
24
|
-
$rootScope.testModel = "";
|
|
25
24
|
const element = $compile('<div ng-setter="testModel"></div>')($rootScope);
|
|
26
25
|
$rootScope.$digest();
|
|
27
26
|
|
|
@@ -32,16 +31,40 @@ describe("setter", () => {
|
|
|
32
31
|
expect($rootScope.testModel).toBe("New content");
|
|
33
32
|
});
|
|
34
33
|
|
|
34
|
+
it("should update the scope model for objects when the element content changes", async () => {
|
|
35
|
+
const element = $compile('<div ng-setter="testModel.a">1</div>')(
|
|
36
|
+
$rootScope,
|
|
37
|
+
);
|
|
38
|
+
$rootScope.$digest();
|
|
39
|
+
|
|
40
|
+
element.html("New content");
|
|
41
|
+
await wait();
|
|
42
|
+
$rootScope.$digest();
|
|
43
|
+
|
|
44
|
+
expect($rootScope.testModel.a).toBe("New content");
|
|
45
|
+
});
|
|
46
|
+
|
|
35
47
|
it("should handle initial content in the element", () => {
|
|
36
|
-
$
|
|
37
|
-
const element = $compile(
|
|
38
|
-
'<div ng-setter="testModel">Initial content</div>',
|
|
39
|
-
)($rootScope);
|
|
48
|
+
$compile('<div ng-setter="testModel">Initial content</div>')($rootScope);
|
|
40
49
|
$rootScope.$digest();
|
|
41
50
|
|
|
42
51
|
expect($rootScope.testModel).toBe("Initial content");
|
|
43
52
|
});
|
|
44
53
|
|
|
54
|
+
it("should handle initial content in the element for objects", () => {
|
|
55
|
+
$compile('<div ng-setter="testModel.a">Initial content</div>')($rootScope);
|
|
56
|
+
$rootScope.$digest();
|
|
57
|
+
|
|
58
|
+
expect($rootScope.testModel.a).toBe("Initial content");
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it("should convert initial content in the element to numbers if possible", () => {
|
|
62
|
+
$compile('<div ng-setter="testModel.a">1</div>')($rootScope);
|
|
63
|
+
$rootScope.$digest();
|
|
64
|
+
|
|
65
|
+
expect($rootScope.testModel.a).toBe(1);
|
|
66
|
+
});
|
|
67
|
+
|
|
45
68
|
it("should warn if no model expression is provided", () => {
|
|
46
69
|
spyOn(console, "warn");
|
|
47
70
|
|
|
@@ -55,9 +78,7 @@ describe("setter", () => {
|
|
|
55
78
|
|
|
56
79
|
it("should clean up the MutationObserver on scope destruction", async () => {
|
|
57
80
|
spyOn(window, "MutationObserver").and.returnValue(observerSpy);
|
|
58
|
-
|
|
59
|
-
const isolateScope = element.isolateScope();
|
|
60
|
-
|
|
81
|
+
$compile('<div ng-setter="testModel"></div>')($rootScope);
|
|
61
82
|
$rootScope.$destroy();
|
|
62
83
|
await wait();
|
|
63
84
|
expect(observerSpy.disconnect).toHaveBeenCalled();
|
package/src/loader.js
CHANGED
|
@@ -33,10 +33,10 @@ export class Angular {
|
|
|
33
33
|
Cache.clear(); // a ensure new instance of angular gets a clean Cache
|
|
34
34
|
|
|
35
35
|
/** @type {Map<number, import("./core/cache/cache").ExpandoStore>} */
|
|
36
|
-
this.
|
|
36
|
+
this.Cache = Cache;
|
|
37
37
|
|
|
38
38
|
/** @type {import('./core/pubsub/pubsub.js').PubSub} */
|
|
39
|
-
this.
|
|
39
|
+
this.EventBus = EventBus;
|
|
40
40
|
|
|
41
41
|
/** @type {string} */
|
|
42
42
|
this.version = VERSION;
|
|
@@ -47,8 +47,6 @@ export class Angular {
|
|
|
47
47
|
/** @type {!Array<string|any>} */
|
|
48
48
|
this.bootsrappedModules = [];
|
|
49
49
|
|
|
50
|
-
/** @type {Function} */
|
|
51
|
-
this.doBootstrap;
|
|
52
50
|
window["angular"] = this;
|
|
53
51
|
publishExternalAPI(this);
|
|
54
52
|
}
|
|
@@ -148,7 +146,7 @@ export class Angular {
|
|
|
148
146
|
* @param {import('./core/scope/scope').Scope} scope
|
|
149
147
|
* @param {JQLite} el
|
|
150
148
|
* @param {*} compile
|
|
151
|
-
* @param {import("./core/di/internal-injector").InjectorService} $injector
|
|
149
|
+
* @param {import("./core/di/internal-injector.js").InjectorService} $injector
|
|
152
150
|
*/
|
|
153
151
|
function (scope, el, compile, $injector) {
|
|
154
152
|
// ng-route deps
|
|
@@ -192,19 +190,12 @@ export class Angular {
|
|
|
192
190
|
*
|
|
193
191
|
* @param {any[]} modules
|
|
194
192
|
* @param {boolean?} strictDi
|
|
195
|
-
* @returns {import("./core/di/internal-injector").InjectorService}
|
|
193
|
+
* @returns {import("./core/di/internal-injector.js").InjectorService}
|
|
196
194
|
*/
|
|
197
195
|
injector(modules, strictDi) {
|
|
198
196
|
return createInjector(modules, strictDi);
|
|
199
197
|
}
|
|
200
198
|
|
|
201
|
-
resumeBootstrap(extraModules) {
|
|
202
|
-
extraModules.forEach((module) => {
|
|
203
|
-
this.bootsrappedModules.push(module);
|
|
204
|
-
});
|
|
205
|
-
return this.doBootstrap();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
199
|
/**
|
|
209
200
|
* @param {Element|Document} element
|
|
210
201
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const services = {
|
|
2
2
|
/** @type {import("../../core/q/q").QService} */
|
|
3
3
|
$q: undefined,
|
|
4
|
-
/** @type {import("../../core/di/internal-injector").InjectorService} */
|
|
4
|
+
/** @type {import("../../core/di/internal-injector.js").InjectorService} */
|
|
5
5
|
$injector: undefined,
|
|
6
6
|
};
|
|
@@ -54,7 +54,7 @@ export class StateRegistryProvider {
|
|
|
54
54
|
"$injector",
|
|
55
55
|
/**
|
|
56
56
|
*
|
|
57
|
-
* @param {import("../../core/di/internal-injector").InjectorService} $injector
|
|
57
|
+
* @param {import("../../core/di/internal-injector.js").InjectorService} $injector
|
|
58
58
|
* @returns
|
|
59
59
|
*/
|
|
60
60
|
($injector) => {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { isDefined, isFunction, isObject } from "../shared/utils.js";
|
|
2
|
-
import { services } from "./common/coreservices";
|
|
3
|
-
import { tail, unnestR } from "../shared/common";
|
|
4
|
-
import { Resolvable } from "./resolve/resolvable";
|
|
5
|
-
import { kebobString } from "../shared/strings";
|
|
6
|
-
import { annotate } from "../core/di/injector";
|
|
2
|
+
import { services } from "./common/coreservices.js";
|
|
3
|
+
import { tail, unnestR } from "../shared/common.js";
|
|
4
|
+
import { Resolvable } from "./resolve/resolvable.js";
|
|
5
|
+
import { kebobString } from "../shared/strings.js";
|
|
6
|
+
import { annotate } from "../core/di/injector.js";
|
|
7
|
+
import { DIRECTIVE_SUFFIX } from "../core/compile/compile.js";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* @typedef BindingTuple
|
|
@@ -31,7 +32,7 @@ export class TemplateFactoryProvider {
|
|
|
31
32
|
* @param {import("../core/cache/cache-factory").TemplateCache} $templateCache
|
|
32
33
|
* @param {any} $templateRequest
|
|
33
34
|
* @param {any} $q
|
|
34
|
-
* @param {import("../core/di/internal-injector").InjectorService} $injector
|
|
35
|
+
* @param {import("../core/di/internal-injector.js").InjectorService} $injector
|
|
35
36
|
* @returns
|
|
36
37
|
*/
|
|
37
38
|
($http, $templateCache, $templateRequest, $q, $injector) => {
|
|
@@ -230,7 +231,7 @@ export class TemplateFactoryProvider {
|
|
|
230
231
|
* @returns
|
|
231
232
|
*/
|
|
232
233
|
function getComponentBindings(name) {
|
|
233
|
-
const cmpDefs = services.$injector.get(name +
|
|
234
|
+
const cmpDefs = services.$injector.get(name + DIRECTIVE_SUFFIX); // could be multiple
|
|
234
235
|
if (!cmpDefs || !cmpDefs.length)
|
|
235
236
|
throw new Error(`Unable to find component named '${name}'`);
|
|
236
237
|
return cmpDefs.map(getBindings).reduce(unnestR, []);
|
|
@@ -209,7 +209,7 @@ export class UrlMatcher {
|
|
|
209
209
|
const placeholder =
|
|
210
210
|
/([:*])([\w[\]]+)|\{([\w[\]]+)(?::\s*((?:[^{}\\]+|\\.|\{(?:[^{}\\]+|\\.)*\})+))?\}/g;
|
|
211
211
|
const searchPlaceholder =
|
|
212
|
-
/([:]?)([\w[\].-]+)|\{([\w[\].-]+)(?::\s*((?:[^{}
|
|
212
|
+
/([:]?)([\w[\].-]+)|\{([\w[\].-]+)(?::\s*((?:[^{\\}]+|\\.|{(?:[^{\\}]+|\\.)*})+))?\}/g;
|
|
213
213
|
const patterns = [];
|
|
214
214
|
let last = 0;
|
|
215
215
|
let matchArray;
|
|
@@ -390,7 +390,7 @@ export function HttpProvider() {
|
|
|
390
390
|
* @param {*} $httpBackend
|
|
391
391
|
* @param {*} $rootScope
|
|
392
392
|
* @param {*} $q
|
|
393
|
-
* @param {import("../../core/di/internal-injector").InjectorService} $injector
|
|
393
|
+
* @param {import("../../core/di/internal-injector.js").InjectorService} $injector
|
|
394
394
|
* @param {*} $sce
|
|
395
395
|
* @returns
|
|
396
396
|
*/
|
|
@@ -61,7 +61,7 @@ export function TemplateRequestProvider() {
|
|
|
61
61
|
"$sce",
|
|
62
62
|
/**
|
|
63
63
|
*
|
|
64
|
-
* @param {import('../core/exception-handler').ErrorHandler} $exceptionHandler
|
|
64
|
+
* @param {import('../core/exception-handler.js').ErrorHandler} $exceptionHandler
|
|
65
65
|
* @param {import('../core/cache/cache-factory').TemplateCache} $templateCache
|
|
66
66
|
* @param {*} $http
|
|
67
67
|
* @param {*} $q
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function AnimateJsProvider($animateProvider: any): void;
|
|
2
2
|
export class AnimateJsProvider {
|
|
3
3
|
constructor($animateProvider: any);
|
|
4
|
-
$get: (string | (($injector: import("../core/di/internal-injector").InjectorService, $$AnimateRunner: any) => (element: any, event: any, classes: any, options: any, ...args: any[]) => {
|
|
4
|
+
$get: (string | (($injector: import("../core/di/internal-injector.js").InjectorService, $$AnimateRunner: any) => (element: any, event: any, classes: any, options: any, ...args: any[]) => {
|
|
5
5
|
$$willAnimate: boolean;
|
|
6
6
|
end(): any;
|
|
7
7
|
start(): any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export function AnimationProvider(): void;
|
|
2
2
|
export class AnimationProvider {
|
|
3
3
|
drivers: any[];
|
|
4
|
-
$get: (string | (($rootScope: any, $injector: import("../core/di/internal-injector").InjectorService, $$AnimateRunner: any, $$rAFScheduler: import("./raf-scheduler").RafScheduler, $$animateCache: any) => (element: any, event: any, options: any) => any))[];
|
|
4
|
+
$get: (string | (($rootScope: any, $injector: import("../core/di/internal-injector.js").InjectorService, $$AnimateRunner: any, $$rAFScheduler: import("./raf-scheduler").RafScheduler, $$animateCache: any) => (element: any, event: any, options: any) => any))[];
|
|
5
5
|
}
|
|
@@ -99,11 +99,12 @@ export class CompileProvider {
|
|
|
99
99
|
* @returns {object} `this` for chaining
|
|
100
100
|
*/
|
|
101
101
|
addPropertySecurityContext: (elementName: string, propertyName: string, ctx: string) => object;
|
|
102
|
-
$get: (string | (($injector: import("../../core/di/internal-injector").InjectorService, $interpolate: any, $exceptionHandler: import("../exception-handler").ErrorHandler, $templateRequest: any, $parse: import("../parse/parse").ParseService, $controller: any, $rootScope: import("../scope/scope").Scope, $sce: any, $animate: any) => ($compileNodes: string | NodeList, transcludeFn: any, maxPriority: any, ignoreDirective: any, previousCompileContext: any) => (scope: any, cloneConnectFn: any, options: any) => JQLite))[];
|
|
102
|
+
$get: (string | (($injector: import("../../core/di/internal-injector.js").InjectorService, $interpolate: any, $exceptionHandler: import("../exception-handler").ErrorHandler, $templateRequest: any, $parse: import("../parse/parse").ParseService, $controller: any, $rootScope: import("../scope/scope").Scope, $sce: any, $animate: any) => ($compileNodes: string | NodeList, transcludeFn: any, maxPriority: any, ignoreDirective: any, previousCompileContext: any) => (scope: any, cloneConnectFn: any, options: any) => JQLite))[];
|
|
103
103
|
}
|
|
104
104
|
export namespace CompileProvider {
|
|
105
105
|
let $inject: string[];
|
|
106
106
|
}
|
|
107
|
+
export const DIRECTIVE_SUFFIX: "Directive";
|
|
107
108
|
/**
|
|
108
109
|
* Function that aggregates all linking fns for a compilation root (nodeList)
|
|
109
110
|
*/
|
|
@@ -31,7 +31,7 @@ export class ControllerProvider {
|
|
|
31
31
|
/**
|
|
32
32
|
* $get method for dependency injection.
|
|
33
33
|
*
|
|
34
|
-
* @param {import("../../core/di/internal-injector").InjectorService} $injector
|
|
34
|
+
* @param {import("../../core/di/internal-injector.js").InjectorService} $injector
|
|
35
35
|
* @returns {Function} A service function that creates controllers.
|
|
36
36
|
*/
|
|
37
37
|
$get: (string | (($injector: any) => (expression: any, locals: any, later: any, ident: any) => any))[];
|
|
@@ -2,7 +2,7 @@ export function FilterProvider($provide: any): void;
|
|
|
2
2
|
export class FilterProvider {
|
|
3
3
|
constructor($provide: any);
|
|
4
4
|
register: (name: any, factory: any) => any;
|
|
5
|
-
$get: (string | (($injector: import("../../core/di/internal-injector").InjectorService) => (name: any) => any))[];
|
|
5
|
+
$get: (string | (($injector: import("../../core/di/internal-injector.js").InjectorService) => (name: any) => any))[];
|
|
6
6
|
}
|
|
7
7
|
export namespace FilterProvider {
|
|
8
8
|
let $inject: string[];
|
package/types/core/q/q.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export function markQExceptionHandled(q: any): void;
|
|
|
41
41
|
*/
|
|
42
42
|
export class $QProvider {
|
|
43
43
|
errorOn: boolean;
|
|
44
|
-
$get: (string | (($rootScope: import("../scope/scope").Scope, $exceptionHandler: import("../exception-handler").ErrorHandler) => any))[];
|
|
44
|
+
$get: (string | (($rootScope: import("../scope/scope").Scope, $exceptionHandler: import("../exception-handler.js").ErrorHandler) => any))[];
|
|
45
45
|
/**
|
|
46
46
|
* Retrieves or overrides whether to generate an error when a rejected promise is not handled.
|
|
47
47
|
* This feature is enabled by default.
|
package/types/core/sce/sce.d.ts
CHANGED
|
@@ -133,7 +133,7 @@ export class SceDelegateProvider {
|
|
|
133
133
|
* array (i.e. there is no `bannedResourceUrlList`.)
|
|
134
134
|
*/
|
|
135
135
|
bannedResourceUrlList: (value: any, ...args: any[]) => any[];
|
|
136
|
-
$get: (string | (($injector: import("../../core/di/internal-injector").InjectorService, $$sanitizeUri: any) => {
|
|
136
|
+
$get: (string | (($injector: import("../../core/di/internal-injector.js").InjectorService, $$sanitizeUri: any) => {
|
|
137
137
|
trustAs: (type: string, trustedValue: any) => any;
|
|
138
138
|
getTrusted: (type: string, maybeTrusted: any) => any;
|
|
139
139
|
valueOf: (maybeTrusted: any) => any;
|
|
@@ -74,7 +74,7 @@ export const $$applyAsyncQueue: Function[];
|
|
|
74
74
|
*/
|
|
75
75
|
export class RootScopeProvider {
|
|
76
76
|
rootScope: Scope;
|
|
77
|
-
$get: (string | ((exceptionHandler: import("../exception-handler").ErrorHandler, parse: import("../parse/parse").ParseService, browser: import("../../services/browser").Browser) => Scope))[];
|
|
77
|
+
$get: (string | ((exceptionHandler: import("../exception-handler.js").ErrorHandler, parse: import("../parse/parse").ParseService, browser: import("../../services/browser").Browser) => Scope))[];
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* DESIGN NOTES
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export class TimeoutProvider {
|
|
2
|
-
$get: (string | (($rootScope: import("../scope/scope").Scope, $browser: import("../../services/browser").Browser, $q: any, $exceptionHandler: import("../exception-handler").ErrorHandler) => {
|
|
2
|
+
$get: (string | (($rootScope: import("../scope/scope").Scope, $browser: import("../../services/browser").Browser, $q: any, $exceptionHandler: import("../exception-handler.js").ErrorHandler) => {
|
|
3
3
|
(fn?: (() => any) | undefined, delay?: number | undefined, invokeApply?: boolean, ...args: any[]): import("../q/q").QPromise<any>;
|
|
4
4
|
/**
|
|
5
5
|
* Cancels a task associated with the `promise`. As a result of this, the promise will be
|
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Dynamically updates an element's content based on events published on a specified channel.
|
|
3
|
-
*
|
|
4
|
-
*
|
|
3
|
+
* If data is sent via `EventBus` on the specified `ngChannel`, the directive attempts to update the element's content accordingly,
|
|
4
|
+
* either by directly setting the inner HTML or merging the scope's data if the element contains a template.
|
|
5
|
+
*
|
|
6
|
+
* If the element has a template and incoming data is an object, the directive will merge all key/value pairs onto the scope,
|
|
7
|
+
* allowing Angular expressions (`{{ yourModel }}`) to be evaluated and rendered.
|
|
5
8
|
*
|
|
6
9
|
* When the scope is destroyed, the directive automatically unsubscribes from the channel.
|
|
10
|
+
* Example:
|
|
11
|
+
*
|
|
12
|
+
* HTML:
|
|
13
|
+
* <div ng-channel="userChannel">Hello {{ user.firstName }} {{ user.lastName }}</div>
|
|
7
14
|
*
|
|
15
|
+
* JavaScript:
|
|
16
|
+
* angular.EventBus.publish('userChannel', { user: { firstName: 'John', lastName: 'Smith' } });
|
|
8
17
|
*
|
|
9
|
-
* @returns {import("../../types").Directive}
|
|
18
|
+
* @returns {import("../../types.js").Directive}
|
|
10
19
|
*/
|
|
11
|
-
export function ngChannelDirective(): import("../../types").Directive;
|
|
20
|
+
export function ngChannelDirective(): import("../../types.js").Directive;
|