@angular-wave/angular.ts 0.0.70 → 0.0.72
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 +1 -1
- package/src/animations/animate-children-directive.md +1 -1
- package/src/animations/animate-css-driver.js +1 -1
- package/src/animations/animate-css.html +2 -2
- package/src/animations/animate-js.html +1 -1
- package/src/animations/animate-queue.js +4 -4
- package/src/animations/animate-swap.md +1 -1
- package/src/{core/animate → animations}/animate.html +1 -1
- package/src/{core/animate → animations}/animate.js +4 -120
- package/src/animations/raf-scheduler.js +7 -3
- package/src/animations/raf-scheduler.spec.js +3 -3
- package/src/animations/shared.js +16 -7
- package/src/binding.spec.js +4 -3
- package/src/core/compile/attributes.js +326 -0
- package/src/core/compile/compile.js +76 -433
- package/src/core/compile/compile.spec.js +45 -28
- package/src/core/di/injector.md +1 -1
- package/src/core/di/ng-module.js +46 -3
- package/src/core/interpolate/interpolate.js +1 -12
- package/src/core/location/location.js +26 -4
- package/src/core/parser/parse.js +50 -47
- package/src/core/prop.spec.js +15 -11
- package/src/core/scope/scope.js +4 -7
- package/src/directive/bind/bind.spec.js +80 -44
- package/src/directive/class/class.js +43 -14
- package/src/directive/class/class.spec.js +7 -4
- package/src/directive/form/form.js +3 -1
- package/src/directive/form/form.spec.js +3 -4
- package/src/directive/if/if-animate-css.html +5 -7
- package/src/directive/if/if.js +1 -1
- package/src/directive/if/if.spec.js +3 -2
- package/src/directive/include/include.js +1 -1
- package/src/directive/input/input.spec.js +6 -4
- package/src/directive/list/list.spec.js +4 -2
- package/src/directive/messages/messages.js +5 -4
- package/src/directive/messages/messages.spec.js +4 -4
- package/src/directive/model/model.spec.js +4 -3
- package/src/directive/model-options/model-options.spec.js +3 -1
- package/src/directive/repeat/repeat.md +1 -1
- package/src/directive/repeat/repeat.spec.js +1 -1
- package/src/directive/select/select.spec.js +3 -3
- package/src/directive/show-hide/show-hide.js +36 -6
- package/src/directive/switch/switch.spec.js +5 -2
- package/src/directive/validators/validators.spec.js +6 -4
- package/src/loader.js +1 -2
- package/src/public.js +22 -10
- package/src/router/state/state-object.js +4 -9
- package/src/router/url/url-matcher.js +1 -1
- package/src/router/url/url-rule.js +5 -1
- package/src/router/url/url-service.js +1 -1
- package/src/services/anchor-scroll.html +1 -1
- package/src/shared/jqlite/jqlite.js +14 -2
- package/src/types.js +1 -1
- package/types/animations/animate-css-driver.d.ts +1 -1
- package/types/animations/animate-queue.d.ts +1 -2
- package/types/{core/animate → animations}/animate.d.ts +2 -12
- package/types/animations/raf-scheduler.d.ts +7 -2
- package/types/animations/shared.d.ts +11 -6
- package/types/core/compile/attributes.d.ts +101 -0
- package/types/core/compile/compile.d.ts +10 -67
- package/types/core/di/ng-module.d.ts +55 -12
- package/types/core/interpolate/interpolate.d.ts +1 -12
- package/types/core/location/location.d.ts +12 -2
- package/types/core/parser/parse.d.ts +10 -10
- package/types/core/scope/scope.d.ts +20 -20
- package/types/directive/form/form.d.ts +2 -11
- package/types/router/state/state-object.d.ts +0 -2
- package/types/router/url/url-matcher.d.ts +2 -2
- package/types/router/url/url-rule.d.ts +2 -1
- package/types/shared/jqlite/jqlite.d.ts +10 -6
- package/types/types.d.ts +1 -1
- package/src/animations/module.js +0 -25
- package/src/core/animate/animate-css.js +0 -88
- package/src/core/animate/anomate.md +0 -13
- package/types/animations/module.d.ts +0 -1
- package/types/core/animate/animate-css.d.ts +0 -19
- /package/src/{core/animate → animations}/animate-runner.js +0 -0
- /package/src/{core/animate → animations}/animate.spec.js +0 -0
- /package/src/{core/animate → animations}/helpers.js +0 -0
- /package/types/{core/animate → animations}/animate-runner.d.ts +0 -0
- /package/types/{core/animate → animations}/helpers.d.ts +0 -0
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Angular } from "../../loader";
|
|
2
|
-
import { createInjector } from "../../core/di/injector";
|
|
3
2
|
import { dealoc } from "../../shared/jqlite/jqlite";
|
|
4
3
|
|
|
5
4
|
describe("ng-bind", () => {
|
|
@@ -14,15 +13,17 @@ describe("ng-bind", () => {
|
|
|
14
13
|
window.angular
|
|
15
14
|
.module("myModule", ["ng"])
|
|
16
15
|
.decorator("$exceptionHandler", function () {
|
|
17
|
-
return (exception
|
|
16
|
+
return (exception) => {
|
|
18
17
|
throw new Error(exception.message);
|
|
19
18
|
};
|
|
20
19
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
$
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
window.angular
|
|
21
|
+
.bootstrap(document.getElementById("dummy"), ["myModule"])
|
|
22
|
+
.invoke((_$rootScope_, _$compile_, _$sce_) => {
|
|
23
|
+
$rootScope = _$rootScope_;
|
|
24
|
+
$compile = _$compile_;
|
|
25
|
+
$sce = _$sce_;
|
|
26
|
+
});
|
|
26
27
|
});
|
|
27
28
|
|
|
28
29
|
afterEach(() => {
|
|
@@ -197,16 +198,26 @@ describe("ng-bind", () => {
|
|
|
197
198
|
|
|
198
199
|
describe("SCE disabled", () => {
|
|
199
200
|
beforeEach(() => {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
$
|
|
209
|
-
|
|
201
|
+
dealoc(document.getElementById("dummy"));
|
|
202
|
+
window.angular
|
|
203
|
+
.module("myModule", [
|
|
204
|
+
"ng",
|
|
205
|
+
($sceProvider) => {
|
|
206
|
+
$sceProvider.enabled(false);
|
|
207
|
+
},
|
|
208
|
+
])
|
|
209
|
+
.decorator("$exceptionHandler", function () {
|
|
210
|
+
return (exception) => {
|
|
211
|
+
throw new Error(exception.message);
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
window.angular
|
|
215
|
+
.bootstrap(document.getElementById("dummy"), ["myModule"])
|
|
216
|
+
.invoke((_$rootScope_, _$compile_, _$sce_) => {
|
|
217
|
+
$rootScope = _$rootScope_;
|
|
218
|
+
$compile = _$compile_;
|
|
219
|
+
$sce = _$sce_;
|
|
220
|
+
});
|
|
210
221
|
});
|
|
211
222
|
|
|
212
223
|
afterEach(() => dealoc(element));
|
|
@@ -243,16 +254,26 @@ describe("ng-bind", () => {
|
|
|
243
254
|
|
|
244
255
|
describe("SCE enabled", () => {
|
|
245
256
|
beforeEach(() => {
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
(
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
$
|
|
255
|
-
|
|
257
|
+
dealoc(document.getElementById("dummy"));
|
|
258
|
+
window.angular
|
|
259
|
+
.module("myModule", [
|
|
260
|
+
"ng",
|
|
261
|
+
($sceProvider) => {
|
|
262
|
+
$sceProvider.enabled(true);
|
|
263
|
+
},
|
|
264
|
+
])
|
|
265
|
+
.decorator("$exceptionHandler", function () {
|
|
266
|
+
return (exception) => {
|
|
267
|
+
throw new Error(exception.message);
|
|
268
|
+
};
|
|
269
|
+
});
|
|
270
|
+
window.angular
|
|
271
|
+
.bootstrap(document.getElementById("dummy"), ["myModule"])
|
|
272
|
+
.invoke((_$rootScope_, _$compile_, _$sce_) => {
|
|
273
|
+
$rootScope = _$rootScope_;
|
|
274
|
+
$compile = _$compile_;
|
|
275
|
+
$sce = _$sce_;
|
|
276
|
+
});
|
|
256
277
|
scope = $rootScope.$new();
|
|
257
278
|
});
|
|
258
279
|
|
|
@@ -292,23 +313,38 @@ describe("ng-bind", () => {
|
|
|
292
313
|
this.val = val;
|
|
293
314
|
}
|
|
294
315
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
$
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
316
|
+
dealoc(document.getElementById("dummy"));
|
|
317
|
+
|
|
318
|
+
window.angular
|
|
319
|
+
.module("myModule", [
|
|
320
|
+
"ng",
|
|
321
|
+
|
|
322
|
+
function ($provide) {
|
|
323
|
+
$provide.decorator("$sce", ($delegate) => {
|
|
324
|
+
$delegate.trustAsHtml = function (html) {
|
|
325
|
+
return new MySafeHtml(html);
|
|
326
|
+
};
|
|
327
|
+
$delegate.getTrustedHtml = function (mySafeHtml) {
|
|
328
|
+
return mySafeHtml.val;
|
|
329
|
+
};
|
|
330
|
+
$delegate.valueOf = function (v) {
|
|
331
|
+
return v instanceof MySafeHtml ? v.val : v;
|
|
332
|
+
};
|
|
333
|
+
return $delegate;
|
|
334
|
+
});
|
|
335
|
+
},
|
|
336
|
+
])
|
|
337
|
+
.decorator("$exceptionHandler", function () {
|
|
338
|
+
return (exception) => {
|
|
339
|
+
throw new Error(exception.message);
|
|
340
|
+
};
|
|
341
|
+
});
|
|
342
|
+
let injector = window.angular.bootstrap(
|
|
343
|
+
document.getElementById("dummy"),
|
|
344
|
+
["myModule"],
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
injector.invoke((_$rootScope_, _$compile_, _$sce_) => {
|
|
312
348
|
$rootScope = _$rootScope_.$new();
|
|
313
349
|
$compile = _$compile_;
|
|
314
350
|
$sce = _$sce_;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { hasAnimate, isObject, isString } from "../../shared/utils";
|
|
2
2
|
|
|
3
3
|
function classDirective(name, selector) {
|
|
4
4
|
name = `ngClass${name}`;
|
|
@@ -34,12 +34,28 @@ function classDirective(name, selector) {
|
|
|
34
34
|
|
|
35
35
|
function addClasses(classString) {
|
|
36
36
|
classString = digestClassCounts(split(classString), 1);
|
|
37
|
-
|
|
37
|
+
if (hasAnimate(element[0])) {
|
|
38
|
+
attr.$addClass(classString);
|
|
39
|
+
} else {
|
|
40
|
+
scope.$$postDigest(() => {
|
|
41
|
+
if (classString !== "") {
|
|
42
|
+
element[0].classList.add(...classString.trim().split(" "));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
38
46
|
}
|
|
39
47
|
|
|
40
48
|
function removeClasses(classString) {
|
|
41
49
|
classString = digestClassCounts(split(classString), -1);
|
|
42
|
-
|
|
50
|
+
if (hasAnimate(element[0])) {
|
|
51
|
+
attr.$removeClass(classString);
|
|
52
|
+
} else {
|
|
53
|
+
scope.$$postDigest(() => {
|
|
54
|
+
if (classString !== "") {
|
|
55
|
+
element[0].classList.remove(...classString.trim().split(" "));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
43
59
|
}
|
|
44
60
|
|
|
45
61
|
function updateClasses(oldClassString, newClassString) {
|
|
@@ -52,22 +68,35 @@ function classDirective(name, selector) {
|
|
|
52
68
|
const toRemoveString = digestClassCounts(toRemoveArray, -1);
|
|
53
69
|
const toAddString = digestClassCounts(toAddArray, 1);
|
|
54
70
|
|
|
55
|
-
|
|
56
|
-
|
|
71
|
+
if (hasAnimate(element[0])) {
|
|
72
|
+
attr.$addClass(toAddString);
|
|
73
|
+
attr.$removeClass(toRemoveString);
|
|
74
|
+
} else {
|
|
75
|
+
scope.$$postDigest(() => {
|
|
76
|
+
if (toAddString !== "") {
|
|
77
|
+
element[0].classList.add(...toAddString.trim().split(" "));
|
|
78
|
+
}
|
|
79
|
+
if (toRemoveString !== "") {
|
|
80
|
+
element[0].classList.remove(
|
|
81
|
+
...toRemoveString.trim().split(" "),
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
57
86
|
}
|
|
58
87
|
|
|
59
88
|
function digestClassCounts(classArray, count) {
|
|
60
89
|
const classesToUpdate = [];
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
90
|
+
if (classArray) {
|
|
91
|
+
classArray.forEach((className) => {
|
|
92
|
+
if (count > 0 || classCounts[className]) {
|
|
93
|
+
classCounts[className] = (classCounts[className] || 0) + count;
|
|
94
|
+
if (classCounts[className] === +(count > 0)) {
|
|
95
|
+
classesToUpdate.push(className);
|
|
96
|
+
}
|
|
67
97
|
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
98
|
+
});
|
|
99
|
+
}
|
|
71
100
|
return classesToUpdate.join(" ");
|
|
72
101
|
}
|
|
73
102
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
2
2
|
import { Angular } from "../../loader";
|
|
3
|
-
import { createInjector } from "../../core/di/injector";
|
|
4
3
|
import { valueFn } from "../../shared/utils";
|
|
5
4
|
|
|
6
5
|
describe("ngClass", () => {
|
|
@@ -11,7 +10,10 @@ describe("ngClass", () => {
|
|
|
11
10
|
|
|
12
11
|
beforeEach(() => {
|
|
13
12
|
window.angular = new Angular();
|
|
14
|
-
|
|
13
|
+
window.angular.module("test", []);
|
|
14
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
15
|
+
"test",
|
|
16
|
+
]);
|
|
15
17
|
$compile = injector.get("$compile");
|
|
16
18
|
$rootScope = injector.get("$rootScope");
|
|
17
19
|
});
|
|
@@ -620,8 +622,9 @@ describe("ngClass", () => {
|
|
|
620
622
|
|
|
621
623
|
// https://github.com/angular/angular.js/issues/15960#issuecomment-299109412
|
|
622
624
|
it("should always reevaluate filters with non-primitive inputs within literals", () => {
|
|
623
|
-
|
|
624
|
-
|
|
625
|
+
dealoc(document.getElementById("dummy"));
|
|
626
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
627
|
+
"test",
|
|
625
628
|
($filterProvider) => {
|
|
626
629
|
$filterProvider.register(
|
|
627
630
|
"foo",
|
|
@@ -109,6 +109,7 @@ export function FormController(
|
|
|
109
109
|
this.$valid = true;
|
|
110
110
|
this.$invalid = false;
|
|
111
111
|
this.$submitted = false;
|
|
112
|
+
/** @type {FormController|Object} */
|
|
112
113
|
this.$$parentForm = nullFormCtrl;
|
|
113
114
|
|
|
114
115
|
this.$$element = $element;
|
|
@@ -326,6 +327,7 @@ FormController.prototype = {
|
|
|
326
327
|
* parent forms of the form.
|
|
327
328
|
*/
|
|
328
329
|
$setSubmitted() {
|
|
330
|
+
/** @type {FormController} */
|
|
329
331
|
let rootForm = this;
|
|
330
332
|
while (rootForm.$$parentForm && rootForm.$$parentForm !== nullFormCtrl) {
|
|
331
333
|
rootForm = rootForm.$$parentForm;
|
|
@@ -589,7 +591,7 @@ const formDirectiveFactory = function (isNgForm) {
|
|
|
589
591
|
};
|
|
590
592
|
|
|
591
593
|
export const formDirective = formDirectiveFactory();
|
|
592
|
-
export const ngFormDirective = formDirectiveFactory(
|
|
594
|
+
export const ngFormDirective = formDirectiveFactory("ngForm");
|
|
593
595
|
|
|
594
596
|
// helper methods
|
|
595
597
|
export function setupValidity(instance) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Angular } from "../../loader";
|
|
2
|
-
import { createInjector } from "../../core/di/injector";
|
|
3
2
|
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
4
3
|
import { FormController } from "./form";
|
|
5
4
|
|
|
@@ -15,11 +14,11 @@ describe("form", () => {
|
|
|
15
14
|
window.angular
|
|
16
15
|
.module("myModule", ["ng"])
|
|
17
16
|
.decorator("$exceptionHandler", function () {
|
|
18
|
-
return (exception
|
|
17
|
+
return (exception) => {
|
|
19
18
|
throw new Error(exception);
|
|
20
19
|
};
|
|
21
20
|
});
|
|
22
|
-
injector =
|
|
21
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
23
22
|
"myModule",
|
|
24
23
|
($compileProvider) => {
|
|
25
24
|
$compileProvider.directive("storeModelCtrl", () => ({
|
|
@@ -1410,7 +1409,7 @@ describe("form", () => {
|
|
|
1410
1409
|
JQLite(dummy).append(doc);
|
|
1411
1410
|
let angular = new Angular();
|
|
1412
1411
|
window.angular = new Angular();
|
|
1413
|
-
myModule = window.angular.module("myModule", [
|
|
1412
|
+
myModule = window.angular.module("myModule", []);
|
|
1414
1413
|
|
|
1415
1414
|
injector = angular.bootstrap(dummy, ["myModule"]);
|
|
1416
1415
|
injector.invoke((_$compile_, $rootScope, _$animate_) => {
|
|
@@ -8,13 +8,11 @@
|
|
|
8
8
|
<script type="module" src="/src/index.js"></script>
|
|
9
9
|
<script>
|
|
10
10
|
document.addEventListener("DOMContentLoaded", () => {
|
|
11
|
-
window.angular
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
transclude: true,
|
|
17
|
-
}));
|
|
11
|
+
window.angular.module("test", []).directive("svgContainer", () => ({
|
|
12
|
+
template: "<svg ng-transclude></svg>",
|
|
13
|
+
replace: true,
|
|
14
|
+
transclude: true,
|
|
15
|
+
}));
|
|
18
16
|
});
|
|
19
17
|
</script>
|
|
20
18
|
|
package/src/directive/if/if.js
CHANGED
|
@@ -17,8 +17,9 @@ describe("ngIf", () => {
|
|
|
17
17
|
beforeEach(function () {
|
|
18
18
|
angular = new Angular();
|
|
19
19
|
window.angular = new Angular();
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
window.angular.module("test", []);
|
|
21
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
22
|
+
"test",
|
|
22
23
|
function (_$compileProvider_) {
|
|
23
24
|
$compileProvider = _$compileProvider_;
|
|
24
25
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isDefined } from "../../shared/utils";
|
|
2
2
|
import { buildFragment } from "../../shared/jqlite/jqlite";
|
|
3
3
|
import { hasAnimate } from "../../shared/utils";
|
|
4
|
-
import { domInsert } from "../../
|
|
4
|
+
import { domInsert } from "../../animations/animate";
|
|
5
5
|
|
|
6
6
|
export const ngIncludeDirective = [
|
|
7
7
|
"$templateRequest",
|
|
@@ -18,10 +18,12 @@ describe("input", () => {
|
|
|
18
18
|
throw new Error(exception.message);
|
|
19
19
|
};
|
|
20
20
|
});
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
window.angular
|
|
22
|
+
.bootstrap(document.getElementById("dummy"), ["myModule"])
|
|
23
|
+
.invoke((_$compile_, $rootScope) => {
|
|
24
|
+
$compile = _$compile_;
|
|
25
|
+
scope = $rootScope.$new();
|
|
26
|
+
});
|
|
25
27
|
});
|
|
26
28
|
|
|
27
29
|
afterEach(() => {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { dealoc } from "../../shared/jqlite/jqlite";
|
|
2
2
|
import { Angular } from "../../loader";
|
|
3
|
-
import { createInjector } from "../../core/di/injector";
|
|
4
3
|
|
|
5
4
|
describe("ngList", () => {
|
|
6
5
|
let $rootScope;
|
|
@@ -11,7 +10,10 @@ describe("ngList", () => {
|
|
|
11
10
|
|
|
12
11
|
beforeEach(() => {
|
|
13
12
|
window.angular = new Angular();
|
|
14
|
-
|
|
13
|
+
window.angular.module("test", []);
|
|
14
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
15
|
+
"test",
|
|
16
|
+
]);
|
|
15
17
|
$compile = injector.get("$compile");
|
|
16
18
|
$rootScope = injector.get("$rootScope");
|
|
17
19
|
});
|
|
@@ -11,17 +11,18 @@ export function ngMessagesDirective($animate) {
|
|
|
11
11
|
const ctrl = this;
|
|
12
12
|
let latestKey = 0;
|
|
13
13
|
let nextAttachId = 0;
|
|
14
|
+
const messages = {};
|
|
15
|
+
let renderLater;
|
|
16
|
+
let cachedCollection;
|
|
17
|
+
|
|
14
18
|
this.head = undefined;
|
|
15
19
|
this.default = undefined;
|
|
20
|
+
this.messages = messages;
|
|
16
21
|
|
|
17
22
|
this.getAttachId = function getAttachId() {
|
|
18
23
|
return nextAttachId++;
|
|
19
24
|
};
|
|
20
25
|
|
|
21
|
-
const messages = (this.messages = {});
|
|
22
|
-
let renderLater;
|
|
23
|
-
let cachedCollection;
|
|
24
|
-
|
|
25
26
|
this.render = function (collection) {
|
|
26
27
|
collection = collection || {};
|
|
27
28
|
|
|
@@ -17,13 +17,13 @@ describe("ngMessages", () => {
|
|
|
17
17
|
template: '<div ng-messages="col"><ng-transclude></ng-transclude></div>',
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
(
|
|
20
|
+
window.angular
|
|
21
|
+
.bootstrap(document.getElementById("dummy"), ["app"])
|
|
22
|
+
.invoke((_$rootScope_, _$compile_, _$templateCache_) => {
|
|
22
23
|
$rootScope = _$rootScope_;
|
|
23
24
|
$compile = _$compile_;
|
|
24
25
|
$templateCache = _$templateCache_;
|
|
25
|
-
}
|
|
26
|
-
);
|
|
26
|
+
});
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
function messageChildren(element) {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { JQLite, dealoc } from "../../shared/jqlite/jqlite";
|
|
2
2
|
import { Angular } from "../../loader";
|
|
3
|
-
import { createInjector } from "../../core/di/injector";
|
|
4
3
|
import { NgModelController } from "./model";
|
|
5
4
|
import { isDefined, valueFn, isObject } from "../../shared/utils";
|
|
6
5
|
import { browserTrigger } from "../../shared/test-utils";
|
|
@@ -20,11 +19,13 @@ describe("ngModel", () => {
|
|
|
20
19
|
window.angular
|
|
21
20
|
.module("myModule", ["ng"])
|
|
22
21
|
.decorator("$exceptionHandler", function () {
|
|
23
|
-
return (exception
|
|
22
|
+
return (exception) => {
|
|
24
23
|
throw new Error(exception.message);
|
|
25
24
|
};
|
|
26
25
|
});
|
|
27
|
-
injector =
|
|
26
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
27
|
+
"myModule",
|
|
28
|
+
]);
|
|
28
29
|
$compile = injector.get("$compile");
|
|
29
30
|
|
|
30
31
|
const attrs = { name: "testAlias", ngModel: "value" };
|
|
@@ -44,7 +44,9 @@ describe("ngModelOptions", () => {
|
|
|
44
44
|
throw new Error(exception.message);
|
|
45
45
|
};
|
|
46
46
|
});
|
|
47
|
-
injector =
|
|
47
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
48
|
+
"myModule",
|
|
49
|
+
]);
|
|
48
50
|
$compile = injector.get("$compile");
|
|
49
51
|
$rootScope = injector.get("$rootScope");
|
|
50
52
|
$q = injector.get("$q");
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
|
|
108
108
|
<example module="ngRepeat" name="ngRepeat-tracking" deps="angular-animate.js" animations="true">
|
|
109
109
|
<file name="script.js">
|
|
110
|
-
angular.module('ngRepeat', [
|
|
110
|
+
angular.module('ngRepeat', []).controller('repeatController', function($scope) {
|
|
111
111
|
let friends = [
|
|
112
112
|
{name:'John', age:25},
|
|
113
113
|
{name:'Mary', age:40},
|
|
@@ -61,7 +61,7 @@ describe("select", () => {
|
|
|
61
61
|
throw new Error(exception);
|
|
62
62
|
};
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
let injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
65
65
|
"myModule",
|
|
66
66
|
($compileProvider) => {
|
|
67
67
|
$compileProvider.directive("spyOnWriteValue", () => ({
|
|
@@ -77,7 +77,6 @@ describe("select", () => {
|
|
|
77
77
|
},
|
|
78
78
|
},
|
|
79
79
|
}));
|
|
80
|
-
|
|
81
80
|
$compileProvider.directive("myOptions", () => ({
|
|
82
81
|
scope: { myOptions: "=" },
|
|
83
82
|
replace: true,
|
|
@@ -96,7 +95,8 @@ describe("select", () => {
|
|
|
96
95
|
},
|
|
97
96
|
}));
|
|
98
97
|
},
|
|
99
|
-
])
|
|
98
|
+
]);
|
|
99
|
+
injector.invoke((_$rootScope_, _$compile_) => {
|
|
100
100
|
scope = _$rootScope_.$new(); // create a child scope because the root scope can't be $destroy-ed
|
|
101
101
|
$rootScope = _$rootScope_;
|
|
102
102
|
$compile = _$compile_;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { hasAnimate } from "../../shared/utils";
|
|
2
|
+
|
|
1
3
|
const NG_HIDE_CLASS = "ng-hide";
|
|
2
4
|
const NG_HIDE_IN_PROGRESS_CLASS = "ng-hide-animate";
|
|
3
5
|
|
|
@@ -15,9 +17,23 @@ export function ngShowDirective($animate) {
|
|
|
15
17
|
// we can control when the element is actually displayed on screen without having
|
|
16
18
|
// to have a global/greedy CSS selector that breaks when other animations are run.
|
|
17
19
|
// Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
if (hasAnimate(element[0])) {
|
|
21
|
+
$animate[value ? "removeClass" : "addClass"](element, NG_HIDE_CLASS, {
|
|
22
|
+
tempClasses: NG_HIDE_IN_PROGRESS_CLASS,
|
|
23
|
+
});
|
|
24
|
+
} else {
|
|
25
|
+
scope.$$postDigest(() => {
|
|
26
|
+
if (value) {
|
|
27
|
+
element
|
|
28
|
+
.elements()
|
|
29
|
+
.forEach((element) => element.classList.remove(NG_HIDE_CLASS));
|
|
30
|
+
} else {
|
|
31
|
+
element
|
|
32
|
+
.elements()
|
|
33
|
+
.forEach((element) => element.classList.add(NG_HIDE_CLASS));
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
}
|
|
21
37
|
});
|
|
22
38
|
},
|
|
23
39
|
};
|
|
@@ -35,9 +51,23 @@ export function ngHideDirective($animate) {
|
|
|
35
51
|
scope.$watch(attr.ngHide, (value) => {
|
|
36
52
|
// The comment inside of the ngShowDirective explains why we add and
|
|
37
53
|
// remove a temporary class for the show/hide animation
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
54
|
+
if (hasAnimate(element[0])) {
|
|
55
|
+
$animate[value ? "addClass" : "removeClass"](element, NG_HIDE_CLASS, {
|
|
56
|
+
tempClasses: NG_HIDE_IN_PROGRESS_CLASS,
|
|
57
|
+
});
|
|
58
|
+
} else {
|
|
59
|
+
scope.$$postDigest(() => {
|
|
60
|
+
if (value) {
|
|
61
|
+
element
|
|
62
|
+
.elements()
|
|
63
|
+
.forEach((element) => element.classList.add(NG_HIDE_CLASS));
|
|
64
|
+
} else {
|
|
65
|
+
element
|
|
66
|
+
.elements()
|
|
67
|
+
.forEach((element) => element.classList.remove(NG_HIDE_CLASS));
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
41
71
|
});
|
|
42
72
|
},
|
|
43
73
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Angular } from "../../loader";
|
|
2
|
-
import { createInjector } from "../../core/di/injector";
|
|
3
2
|
import { dealoc } from "../../shared/jqlite/jqlite";
|
|
4
3
|
|
|
5
4
|
describe("ngSwitch", () => {
|
|
@@ -10,7 +9,11 @@ describe("ngSwitch", () => {
|
|
|
10
9
|
|
|
11
10
|
beforeEach(() => {
|
|
12
11
|
window.angular = new Angular();
|
|
13
|
-
|
|
12
|
+
window.angular.module("test", []);
|
|
13
|
+
let injector = window.angular.bootstrap(
|
|
14
|
+
document.getElementById("dummy", ["test"]),
|
|
15
|
+
);
|
|
16
|
+
injector.invoke(($rootScope, _$compile_, _$timeout_) => {
|
|
14
17
|
$scope = $rootScope.$new();
|
|
15
18
|
$compile = _$compile_;
|
|
16
19
|
$timeout = _$timeout_;
|
|
@@ -17,10 +17,12 @@ describe("validators", () => {
|
|
|
17
17
|
throw new Error(exception);
|
|
18
18
|
};
|
|
19
19
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
$
|
|
23
|
-
|
|
20
|
+
window.angular
|
|
21
|
+
.bootstrap(document.getElementById("dummy"), ["myModule"])
|
|
22
|
+
.invoke((_$compile_, _$rootScope_) => {
|
|
23
|
+
$compile = _$compile_;
|
|
24
|
+
$rootScope = _$rootScope_;
|
|
25
|
+
});
|
|
24
26
|
});
|
|
25
27
|
|
|
26
28
|
afterEach(() => {
|
package/src/loader.js
CHANGED
|
@@ -140,8 +140,7 @@ export class Angular {
|
|
|
140
140
|
"$compile",
|
|
141
141
|
"$injector",
|
|
142
142
|
/**
|
|
143
|
-
*
|
|
144
|
-
* @param {*} scope
|
|
143
|
+
* @param {import('./core/scope/scope').Scope} scope
|
|
145
144
|
* @param {JQLite} el
|
|
146
145
|
* @param {*} compile
|
|
147
146
|
* @param {import("./core/di/internal-injector").InjectorService} $injector
|