@angular-wave/angular.ts 0.0.71 → 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 +2 -2
- package/src/binding.spec.js +4 -3
- 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/prop.spec.js +15 -11
- 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 +1 -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.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/services/anchor-scroll.html +1 -1
- package/src/shared/jqlite/jqlite.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/core/di/ng-module.d.ts +55 -12
- package/types/shared/jqlite/jqlite.d.ts +2 -2
- 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
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@angular-wave/angular.ts",
|
|
3
3
|
"description": "A modern, optimized and typesafe version of AngularJS",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.72",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "dist/angular-ts.esm.js",
|
|
8
8
|
"browser": "dist/angular-ts.umd.js",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
|
|
71
71
|
</file>
|
|
72
72
|
<file name="script.js">
|
|
73
|
-
angular.module('ngAnimateChildren', [
|
|
73
|
+
angular.module('ngAnimateChildren', [])
|
|
74
74
|
.controller('MainController', function MainController() {
|
|
75
75
|
this.animateChildren = false;
|
|
76
76
|
this.enterElement = false;
|
|
@@ -26,7 +26,7 @@ export function $$AnimateCssDriverProvider($$animationProvider) {
|
|
|
26
26
|
/**
|
|
27
27
|
*
|
|
28
28
|
* @param {*} $animateCss
|
|
29
|
-
* @param {typeof import('
|
|
29
|
+
* @param {typeof import('./animate-runner').AnimateRunner} $$AnimateRunner
|
|
30
30
|
* @param {JQLite} $rootElement
|
|
31
31
|
* @returns
|
|
32
32
|
*/
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
<!--
|
|
10
10
|
<script src="https://cdn.jsdelivr.net/npm/angular@1.8.3/angular.js"></script>
|
|
11
11
|
<script src="https://cdn.jsdelivr.net/npm/angular-animate@1.8.3/angular-animate.js"></script>
|
|
12
|
-
<script>window.angular.module("test", [
|
|
12
|
+
<script>window.angular.module("test", [])</script> -->
|
|
13
13
|
|
|
14
14
|
<script type="module" src="/src/index.js"></script>
|
|
15
15
|
<script>
|
|
16
16
|
document.addEventListener("DOMContentLoaded", () => {
|
|
17
|
-
window.angular.module("test", [
|
|
17
|
+
window.angular.module("test", []);
|
|
18
18
|
});
|
|
19
19
|
</script>
|
|
20
20
|
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
<script src="https://cdn.jsdelivr.net/npm/animejs@3.2.2/lib/anime.min.js"></script>
|
|
10
10
|
<script>
|
|
11
11
|
document.addEventListener("DOMContentLoaded", () => {
|
|
12
|
-
window.angular.module("test", [
|
|
12
|
+
window.angular.module("test", []).animation(".colorful", [
|
|
13
13
|
function () {
|
|
14
14
|
return {
|
|
15
15
|
addClass: function (element, className, doneFn) {
|
|
@@ -145,14 +145,14 @@ export function $$AnimateQueueProvider($animateProvider) {
|
|
|
145
145
|
|
|
146
146
|
this.$get = [
|
|
147
147
|
"$rootScope",
|
|
148
|
-
"$
|
|
148
|
+
"$injector",
|
|
149
149
|
"$$animation",
|
|
150
150
|
"$$AnimateRunner",
|
|
151
151
|
"$templateRequest",
|
|
152
152
|
/**
|
|
153
153
|
*
|
|
154
154
|
* @param {*} $rootScope
|
|
155
|
-
* @param {
|
|
155
|
+
* @param {*} $injector
|
|
156
156
|
* @param {*} $$animation
|
|
157
157
|
* @param {*} $$AnimateRunner
|
|
158
158
|
* @param {*} $templateRequest
|
|
@@ -160,7 +160,7 @@ export function $$AnimateQueueProvider($animateProvider) {
|
|
|
160
160
|
*/
|
|
161
161
|
function (
|
|
162
162
|
$rootScope,
|
|
163
|
-
$
|
|
163
|
+
$injector,
|
|
164
164
|
$$animation,
|
|
165
165
|
$$AnimateRunner,
|
|
166
166
|
$templateRequest,
|
|
@@ -747,7 +747,7 @@ export function $$AnimateQueueProvider($animateProvider) {
|
|
|
747
747
|
*/
|
|
748
748
|
function areAnimationsAllowed(node, parentNode) {
|
|
749
749
|
const bodyNode = document.body;
|
|
750
|
-
const rootNode = getDomNode($rootElement);
|
|
750
|
+
const rootNode = getDomNode($injector.get("$rootElement"));
|
|
751
751
|
|
|
752
752
|
let bodyNodeDetected = node === bodyNode || node.nodeName === "HTML";
|
|
753
753
|
let rootNodeDetected = node === rootNode;
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
- </div>
|
|
33
33
|
- </file>
|
|
34
34
|
- <file name="script.js">
|
|
35
|
-
- angular.module('ngAnimateSwapExample', [
|
|
35
|
+
- angular.module('ngAnimateSwapExample', [])
|
|
36
36
|
- .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) {
|
|
37
37
|
- $scope.number = 0;
|
|
38
38
|
- $interval(function() {
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<script src="/jasmine/jasmine-5.1.2/jasmine-html.js"></script>
|
|
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
|
-
<script type="module" src="/src/
|
|
13
|
+
<script type="module" src="/src/animations/animate.spec.js"></script>
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<div id="dummy"></div>
|
|
@@ -5,10 +5,9 @@ import {
|
|
|
5
5
|
isString,
|
|
6
6
|
minErr,
|
|
7
7
|
extend,
|
|
8
|
-
} from "
|
|
9
|
-
import { JQLite } from "
|
|
10
|
-
import { NG_ANIMATE_CLASSNAME } from "
|
|
11
|
-
import { addInlineStyles } from "./helpers";
|
|
8
|
+
} from "../shared/utils";
|
|
9
|
+
import { JQLite } from "../shared/jqlite/jqlite";
|
|
10
|
+
import { NG_ANIMATE_CLASSNAME } from "./shared";
|
|
12
11
|
|
|
13
12
|
/** @typedef {"enter"|"leave"|"move"|"addClass"|"setClass"|"removeClass"} AnimationMethod */
|
|
14
13
|
|
|
@@ -70,121 +69,6 @@ function prepareAnimateOptions(options) {
|
|
|
70
69
|
return isObject(options) ? options : {};
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
// this is prefixed with Core since it conflicts with
|
|
74
|
-
// the animateQueueProvider defined in ngAnimate/animateQueue.js
|
|
75
|
-
export function CoreAnimateQueueProvider() {
|
|
76
|
-
const postDigestQueue = new Map();
|
|
77
|
-
const postDigestElements = [];
|
|
78
|
-
|
|
79
|
-
this.$get = [
|
|
80
|
-
"$$AnimateRunner",
|
|
81
|
-
"$rootScope",
|
|
82
|
-
function ($$AnimateRunner, $rootScope) {
|
|
83
|
-
return {
|
|
84
|
-
enabled: () => {},
|
|
85
|
-
on: () => {},
|
|
86
|
-
off: () => {},
|
|
87
|
-
pin: () => {},
|
|
88
|
-
|
|
89
|
-
push(element, event, options, domOperation) {
|
|
90
|
-
if (domOperation) {
|
|
91
|
-
domOperation();
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
options = options || {};
|
|
95
|
-
if (options.from) {
|
|
96
|
-
addInlineStyles(element[0], options.from);
|
|
97
|
-
}
|
|
98
|
-
if (options.to) {
|
|
99
|
-
addInlineStyles(element[0], options.to);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (options.addClass || options.removeClass) {
|
|
103
|
-
addRemoveClassesPostDigest(
|
|
104
|
-
element,
|
|
105
|
-
options.addClass,
|
|
106
|
-
options.removeClass,
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const runner = new $$AnimateRunner();
|
|
111
|
-
|
|
112
|
-
// since there are no animations to run the runner needs to be
|
|
113
|
-
// notified that the animation call is complete.
|
|
114
|
-
runner.complete();
|
|
115
|
-
return runner;
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
function updateData(data, classes, value) {
|
|
120
|
-
let changed = false;
|
|
121
|
-
if (classes) {
|
|
122
|
-
classes = isString(classes)
|
|
123
|
-
? classes.split(" ")
|
|
124
|
-
: Array.isArray(classes)
|
|
125
|
-
? classes
|
|
126
|
-
: [];
|
|
127
|
-
forEach(classes, (className) => {
|
|
128
|
-
if (className) {
|
|
129
|
-
changed = true;
|
|
130
|
-
data[className] = value;
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
return changed;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function handleCSSClassChanges() {
|
|
138
|
-
forEach(postDigestElements, function (element) {
|
|
139
|
-
const data = postDigestQueue.get(element);
|
|
140
|
-
if (data) {
|
|
141
|
-
const existing = splitClasses(element.attr("class"));
|
|
142
|
-
let toAdd = "";
|
|
143
|
-
let toRemove = "";
|
|
144
|
-
forEach(data, function (status, className) {
|
|
145
|
-
const hasClass = !!existing[className];
|
|
146
|
-
if (status !== hasClass) {
|
|
147
|
-
if (status) {
|
|
148
|
-
toAdd += (toAdd.length ? " " : "") + className;
|
|
149
|
-
} else {
|
|
150
|
-
toRemove += (toRemove.length ? " " : "") + className;
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
forEach(element, function (elm) {
|
|
156
|
-
if (toRemove) {
|
|
157
|
-
toRemove.split(" ").forEach((css) => elm.classList.remove(css));
|
|
158
|
-
}
|
|
159
|
-
if (toAdd) {
|
|
160
|
-
toAdd.split(" ").forEach((css) => elm.classList.add(css));
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
postDigestQueue.delete(element);
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
postDigestElements.length = 0;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function addRemoveClassesPostDigest(element, add, remove) {
|
|
170
|
-
const data = postDigestQueue.get(element) || {};
|
|
171
|
-
|
|
172
|
-
const classesAdded = updateData(data, add, true);
|
|
173
|
-
const classesRemoved = updateData(data, remove, false);
|
|
174
|
-
|
|
175
|
-
if (classesAdded || classesRemoved) {
|
|
176
|
-
postDigestQueue.set(element, data);
|
|
177
|
-
postDigestElements.push(element);
|
|
178
|
-
|
|
179
|
-
if (postDigestElements.length === 1) {
|
|
180
|
-
$rootScope.$$postDigest(handleCSSClassChanges);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
];
|
|
186
|
-
}
|
|
187
|
-
|
|
188
72
|
export function domInsert(element, parentElement, afterElement) {
|
|
189
73
|
// if for some reason the previous element was removed
|
|
190
74
|
// from the dom sometime before this code runs then let's
|
|
@@ -502,7 +386,7 @@ export function AnimateProvider($provide) {
|
|
|
502
386
|
* @example
|
|
503
387
|
<example module="animationExample" deps="angular-animate.js" animations="true" name="animate-cancel">
|
|
504
388
|
<file name="app.js">
|
|
505
|
-
angular.module('animationExample', [
|
|
389
|
+
angular.module('animationExample', []).component('cancelExample', {
|
|
506
390
|
templateUrl: 'template.html',
|
|
507
391
|
controller: function($element, $animate) {
|
|
508
392
|
this.runner = null;
|
|
@@ -7,9 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Creates a requestAnimationFrame scheduler.
|
|
10
|
-
* @returns {RafScheduler} The scheduler object.
|
|
11
10
|
*/
|
|
12
|
-
export function
|
|
11
|
+
export function RafSchedulerProvider() {
|
|
13
12
|
/**
|
|
14
13
|
* @type {Array<Array<Function>>}
|
|
15
14
|
*/
|
|
@@ -68,5 +67,10 @@ export function $$rAFSchedulerFactory() {
|
|
|
68
67
|
});
|
|
69
68
|
};
|
|
70
69
|
|
|
71
|
-
|
|
70
|
+
/**
|
|
71
|
+
* @returns {RafScheduler} The scheduler object.
|
|
72
|
+
*/
|
|
73
|
+
this.$get = function () {
|
|
74
|
+
return scheduler;
|
|
75
|
+
};
|
|
72
76
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RafSchedulerProvider } from "./raf-scheduler";
|
|
2
2
|
|
|
3
|
-
describe("
|
|
3
|
+
describe("RafSchedulerProvider", function () {
|
|
4
4
|
let scheduler;
|
|
5
5
|
let rAFCallbacks;
|
|
6
6
|
let originalRequestAnimationFrame;
|
|
@@ -8,7 +8,7 @@ describe("$$rAFSchedulerFactory", function () {
|
|
|
8
8
|
|
|
9
9
|
beforeEach(function () {
|
|
10
10
|
rAFCallbacks = [];
|
|
11
|
-
scheduler =
|
|
11
|
+
scheduler = new RafSchedulerProvider().$get();
|
|
12
12
|
|
|
13
13
|
originalRequestAnimationFrame = window.requestAnimationFrame;
|
|
14
14
|
originalCancelAnimationFrame = window.cancelAnimationFrame;
|
package/src/animations/shared.js
CHANGED
|
@@ -166,11 +166,11 @@ export function extractElementNode(element) {
|
|
|
166
166
|
export function applyAnimationClassesFactory() {
|
|
167
167
|
return function (element, options) {
|
|
168
168
|
if (options.addClass) {
|
|
169
|
-
element[0].classList.add(options.addClass);
|
|
169
|
+
element[0].classList.add(...options.addClass.trim().split(" "));
|
|
170
170
|
options.addClass = null;
|
|
171
171
|
}
|
|
172
172
|
if (options.removeClass) {
|
|
173
|
-
element[0].classList.remove(options.removeClass);
|
|
173
|
+
element[0].classList.remove(...options.removeClass.trim().split(" "));
|
|
174
174
|
options.removeClass = null;
|
|
175
175
|
}
|
|
176
176
|
};
|
package/src/binding.spec.js
CHANGED
|
@@ -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 { browserTrigger } from "./shared/test-utils";
|
|
5
4
|
|
|
6
5
|
describe("binding", () => {
|
|
@@ -21,11 +20,13 @@ describe("binding", () => {
|
|
|
21
20
|
window.angular = new Angular();
|
|
22
21
|
myModule = window.angular.module("myModule", ["ng"]);
|
|
23
22
|
myModule.decorator("$exceptionHandler", function () {
|
|
24
|
-
return (exception
|
|
23
|
+
return (exception) => {
|
|
25
24
|
errors.push(exception.message);
|
|
26
25
|
};
|
|
27
26
|
});
|
|
28
|
-
$injector =
|
|
27
|
+
$injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
28
|
+
"myModule",
|
|
29
|
+
]);
|
|
29
30
|
$rootScope = $injector.get("$rootScope");
|
|
30
31
|
$compile = $injector.get("$compile");
|
|
31
32
|
$exceptionHandler = $injector.get("$exceptionHandler");
|
|
@@ -58,12 +58,15 @@ describe("$compile", () => {
|
|
|
58
58
|
$sce;
|
|
59
59
|
|
|
60
60
|
beforeEach(() => {
|
|
61
|
+
dealoc(document.getElementById("dummy"));
|
|
61
62
|
log = [];
|
|
62
63
|
window.angular = new Angular();
|
|
63
64
|
module = window.angular.module("test1", ["ng"]);
|
|
64
65
|
defaultModule = window.angular.module("defaultModule", ["ng"]);
|
|
65
66
|
myModule = window.angular.module("myModule", ["ng"]);
|
|
66
|
-
injector =
|
|
67
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
68
|
+
"defaultModule",
|
|
69
|
+
]);
|
|
67
70
|
$rootScope = injector.get("$rootScope");
|
|
68
71
|
$compile = injector.get("$compile");
|
|
69
72
|
$templateCache = injector.get("$templateCache");
|
|
@@ -177,7 +180,10 @@ describe("$compile", () => {
|
|
|
177
180
|
}
|
|
178
181
|
|
|
179
182
|
function initInjector(name) {
|
|
180
|
-
|
|
183
|
+
dealoc(document.getElementById("dummy"));
|
|
184
|
+
injector = window.angular.bootstrap(document.getElementById("dummy"), [
|
|
185
|
+
name,
|
|
186
|
+
]);
|
|
181
187
|
reloadInjector();
|
|
182
188
|
}
|
|
183
189
|
|
|
@@ -7496,15 +7502,15 @@ describe("$compile", () => {
|
|
|
7496
7502
|
},
|
|
7497
7503
|
}),
|
|
7498
7504
|
);
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
(
|
|
7505
|
+
dealoc(document.getElementById("dummy"));
|
|
7506
|
+
window.angular
|
|
7507
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
7508
|
+
.invoke((_$compile_, _$rootScope_, _$templateCache_, _$sce_) => {
|
|
7502
7509
|
$compile = _$compile_;
|
|
7503
7510
|
$rootScope = _$rootScope_;
|
|
7504
7511
|
$templateCache = _$templateCache_;
|
|
7505
7512
|
$sce = _$sce_;
|
|
7506
|
-
}
|
|
7507
|
-
);
|
|
7513
|
+
});
|
|
7508
7514
|
});
|
|
7509
7515
|
|
|
7510
7516
|
it("should compile and link both attribute and text bindings", () => {
|
|
@@ -9730,10 +9736,13 @@ describe("$compile", () => {
|
|
|
9730
9736
|
template: "1:{{param1}};2:{{param2}};3:{{::param1}};4:{{::param2}}",
|
|
9731
9737
|
}));
|
|
9732
9738
|
|
|
9733
|
-
|
|
9734
|
-
|
|
9735
|
-
|
|
9736
|
-
|
|
9739
|
+
dealoc(document.getElementById("dummy"));
|
|
9740
|
+
window.angular
|
|
9741
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9742
|
+
.invoke((_$compile_, _$rootScope_) => {
|
|
9743
|
+
$compile = _$compile_;
|
|
9744
|
+
$rootScope = _$rootScope_;
|
|
9745
|
+
});
|
|
9737
9746
|
|
|
9738
9747
|
element = $compile(
|
|
9739
9748
|
'<div other-tpl-dir param1="::foo" param2="bar"></div>',
|
|
@@ -9765,10 +9774,13 @@ describe("$compile", () => {
|
|
|
9765
9774
|
template: "1:{{param1}};2:{{param2}};3:{{::param1}};4:{{::param2}}",
|
|
9766
9775
|
}));
|
|
9767
9776
|
|
|
9768
|
-
|
|
9769
|
-
|
|
9770
|
-
|
|
9771
|
-
|
|
9777
|
+
dealoc(document.getElementById("dummy"));
|
|
9778
|
+
window.angular
|
|
9779
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9780
|
+
.invoke((_$compile_, _$rootScope_) => {
|
|
9781
|
+
$compile = _$compile_;
|
|
9782
|
+
$rootScope = _$rootScope_;
|
|
9783
|
+
});
|
|
9772
9784
|
|
|
9773
9785
|
element = $compile(
|
|
9774
9786
|
'<div other-tpl-dir param1="{{::foo}}" param2="{{bar}}"></div>',
|
|
@@ -9800,13 +9812,14 @@ describe("$compile", () => {
|
|
|
9800
9812
|
templateUrl: "other.html",
|
|
9801
9813
|
}));
|
|
9802
9814
|
|
|
9803
|
-
|
|
9804
|
-
|
|
9815
|
+
dealoc(document.getElementById("dummy"));
|
|
9816
|
+
window.angular
|
|
9817
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9818
|
+
.invoke((_$compile_, _$rootScope_, _$templateCache_) => {
|
|
9805
9819
|
$compile = _$compile_;
|
|
9806
9820
|
$rootScope = _$rootScope_;
|
|
9807
9821
|
$templateCache = _$templateCache_;
|
|
9808
|
-
}
|
|
9809
|
-
);
|
|
9822
|
+
});
|
|
9810
9823
|
|
|
9811
9824
|
$templateCache.put(
|
|
9812
9825
|
"other.html",
|
|
@@ -9841,13 +9854,14 @@ describe("$compile", () => {
|
|
|
9841
9854
|
templateUrl: "other.html",
|
|
9842
9855
|
}));
|
|
9843
9856
|
|
|
9844
|
-
|
|
9845
|
-
|
|
9857
|
+
dealoc(document.getElementById("dummy"));
|
|
9858
|
+
window.angular
|
|
9859
|
+
.bootstrap(document.getElementById("dummy"), ["test1"])
|
|
9860
|
+
.invoke((_$compile_, _$rootScope_, _$templateCache_) => {
|
|
9846
9861
|
$compile = _$compile_;
|
|
9847
9862
|
$rootScope = _$rootScope_;
|
|
9848
9863
|
$templateCache = _$templateCache_;
|
|
9849
|
-
}
|
|
9850
|
-
);
|
|
9864
|
+
});
|
|
9851
9865
|
|
|
9852
9866
|
$templateCache.put(
|
|
9853
9867
|
"other.html",
|
|
@@ -16810,15 +16824,16 @@ describe("$compile", () => {
|
|
|
16810
16824
|
});
|
|
16811
16825
|
|
|
16812
16826
|
describe("multi-element directive", () => {
|
|
16813
|
-
it("should group on link function", () => {
|
|
16827
|
+
it("should group on link function", async () => {
|
|
16814
16828
|
$rootScope.show = false;
|
|
16815
16829
|
element = $compile(
|
|
16816
16830
|
"<div>" +
|
|
16817
16831
|
'<span ng-show-start="show"></span>' +
|
|
16818
|
-
"<span ng-show-end></span>" +
|
|
16832
|
+
"<span ng-show-end='show'></span>" +
|
|
16819
16833
|
"</div>",
|
|
16820
16834
|
)($rootScope);
|
|
16821
16835
|
$rootScope.$digest();
|
|
16836
|
+
await wait(100);
|
|
16822
16837
|
const spans = element.find("span");
|
|
16823
16838
|
expect(spans.eq(0)[0].classList.contains("ng-hide")).toBeTrue();
|
|
16824
16839
|
expect(spans.eq(1)[0].classList.contains("ng-hide")).toBeTrue();
|
|
@@ -17121,7 +17136,7 @@ describe("$compile", () => {
|
|
|
17121
17136
|
}).toThrowError(/uterdir/);
|
|
17122
17137
|
});
|
|
17123
17138
|
|
|
17124
|
-
it("should support data- prefix", () => {
|
|
17139
|
+
it("should support data- prefix", async () => {
|
|
17125
17140
|
$rootScope.show = false;
|
|
17126
17141
|
element = $compile(
|
|
17127
17142
|
"<div>" +
|
|
@@ -17132,11 +17147,13 @@ describe("$compile", () => {
|
|
|
17132
17147
|
"</div>",
|
|
17133
17148
|
)($rootScope);
|
|
17134
17149
|
$rootScope.$digest();
|
|
17150
|
+
await wait(100);
|
|
17135
17151
|
const spans = element.find("span");
|
|
17152
|
+
debugger;
|
|
17136
17153
|
expect(spans.eq(0)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17137
|
-
expect(spans.eq(1)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17154
|
+
//expect(spans.eq(1)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17138
17155
|
expect(spans.eq(2)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17139
|
-
expect(spans.eq(3)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17156
|
+
// expect(spans.eq(3)[0].classList.contains("ng-hide")).toBeTrue();
|
|
17140
17157
|
});
|
|
17141
17158
|
});
|
|
17142
17159
|
|
package/src/core/di/injector.md
CHANGED
package/src/core/di/ng-module.js
CHANGED
|
@@ -25,7 +25,6 @@ export const CONTROLLER_LITERAL = "$controllerProvider";
|
|
|
25
25
|
*/
|
|
26
26
|
export class NgModule {
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
29
28
|
* @param {String} name - Name of the module
|
|
30
29
|
* @param {Array<String>} requires - List of modules which the injector will load before the current module
|
|
31
30
|
* @param {Function} [configFn]
|
|
@@ -78,7 +77,7 @@ export class NgModule {
|
|
|
78
77
|
}
|
|
79
78
|
|
|
80
79
|
/**
|
|
81
|
-
* @param {
|
|
80
|
+
* @param {string} name
|
|
82
81
|
* @param {any} object
|
|
83
82
|
* @returns {NgModule}
|
|
84
83
|
*/
|
|
@@ -88,7 +87,7 @@ export class NgModule {
|
|
|
88
87
|
}
|
|
89
88
|
|
|
90
89
|
/**
|
|
91
|
-
* @param {
|
|
90
|
+
* @param {string} name
|
|
92
91
|
* @param {any} object
|
|
93
92
|
* @returns {NgModule}
|
|
94
93
|
*/
|
|
@@ -107,11 +106,20 @@ export class NgModule {
|
|
|
107
106
|
return this;
|
|
108
107
|
}
|
|
109
108
|
|
|
109
|
+
/**
|
|
110
|
+
* @param {Function} block
|
|
111
|
+
* @returns {NgModule}
|
|
112
|
+
*/
|
|
110
113
|
run(block) {
|
|
111
114
|
this.runBlocks.push(block);
|
|
112
115
|
return this;
|
|
113
116
|
}
|
|
114
117
|
|
|
118
|
+
/**
|
|
119
|
+
* @param {string} name
|
|
120
|
+
* @param {*} options
|
|
121
|
+
* @returns {NgModule}
|
|
122
|
+
*/
|
|
115
123
|
component(name, options) {
|
|
116
124
|
if (options && isFunction(options)) {
|
|
117
125
|
options.$$moduleName = name;
|
|
@@ -120,6 +128,11 @@ export class NgModule {
|
|
|
120
128
|
return this;
|
|
121
129
|
}
|
|
122
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @param {string} name
|
|
133
|
+
* @param {*} providerFunction
|
|
134
|
+
* @returns {NgModule}
|
|
135
|
+
*/
|
|
123
136
|
factory(name, providerFunction) {
|
|
124
137
|
if (providerFunction && isFunction(providerFunction)) {
|
|
125
138
|
providerFunction.$$moduleName = name;
|
|
@@ -132,6 +145,11 @@ export class NgModule {
|
|
|
132
145
|
return this;
|
|
133
146
|
}
|
|
134
147
|
|
|
148
|
+
/**
|
|
149
|
+
* @param {string} name
|
|
150
|
+
* @param {*} serviceFunction
|
|
151
|
+
* @returns {NgModule}
|
|
152
|
+
*/
|
|
135
153
|
service(name, serviceFunction) {
|
|
136
154
|
if (serviceFunction && isFunction(serviceFunction)) {
|
|
137
155
|
serviceFunction.$$moduleName = name;
|
|
@@ -144,6 +162,11 @@ export class NgModule {
|
|
|
144
162
|
return this;
|
|
145
163
|
}
|
|
146
164
|
|
|
165
|
+
/**
|
|
166
|
+
* @param {string} name
|
|
167
|
+
* @param {*} providerType
|
|
168
|
+
* @returns {NgModule}
|
|
169
|
+
*/
|
|
147
170
|
provider(name, providerType) {
|
|
148
171
|
if (providerType && isFunction(providerType)) {
|
|
149
172
|
providerType.$$moduleName = name;
|
|
@@ -152,6 +175,11 @@ export class NgModule {
|
|
|
152
175
|
return this;
|
|
153
176
|
}
|
|
154
177
|
|
|
178
|
+
/**
|
|
179
|
+
* @param {string} name
|
|
180
|
+
* @param {*} decorFn
|
|
181
|
+
* @returns {NgModule}
|
|
182
|
+
*/
|
|
155
183
|
decorator(name, decorFn) {
|
|
156
184
|
if (decorFn && isFunction(decorFn)) {
|
|
157
185
|
decorFn.$$moduleName = name;
|
|
@@ -160,6 +188,11 @@ export class NgModule {
|
|
|
160
188
|
return this;
|
|
161
189
|
}
|
|
162
190
|
|
|
191
|
+
/**
|
|
192
|
+
* @param {string} name
|
|
193
|
+
* @param {*} directiveFactory
|
|
194
|
+
* @returns {NgModule}
|
|
195
|
+
*/
|
|
163
196
|
directive(name, directiveFactory) {
|
|
164
197
|
if (directiveFactory && isFunction(directiveFactory)) {
|
|
165
198
|
directiveFactory.$$moduleName = name;
|
|
@@ -172,6 +205,11 @@ export class NgModule {
|
|
|
172
205
|
return this;
|
|
173
206
|
}
|
|
174
207
|
|
|
208
|
+
/**
|
|
209
|
+
* @param {string} name
|
|
210
|
+
* @param {*} animationFactory
|
|
211
|
+
* @returns {NgModule}
|
|
212
|
+
*/
|
|
175
213
|
animation(name, animationFactory) {
|
|
176
214
|
if (animationFactory && isFunction(animationFactory)) {
|
|
177
215
|
animationFactory.$$moduleName = name;
|
|
@@ -192,6 +230,11 @@ export class NgModule {
|
|
|
192
230
|
return this;
|
|
193
231
|
}
|
|
194
232
|
|
|
233
|
+
/**
|
|
234
|
+
* @param {string} name
|
|
235
|
+
* @param {*} ctlFn
|
|
236
|
+
* @returns {NgModule}
|
|
237
|
+
*/
|
|
195
238
|
controller(name, ctlFn) {
|
|
196
239
|
if (ctlFn && isFunction(ctlFn)) {
|
|
197
240
|
ctlFn.$$moduleName = name;
|