@angular-wave/angular.ts 0.2.1 → 0.2.3
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/angular.spec.js +1 -1
- package/src/animations/animate.spec.js +1 -1
- package/src/core/compile/attributes.js +1 -1
- package/src/core/compile/compile.js +10 -6
- package/src/core/compile/compile.spec.js +0 -6
- package/src/core/controller/controller.js +85 -131
- package/src/core/di/internal-injector.js +14 -14
- package/src/core/di/ng-module.js +2 -2
- package/src/core/filter/filter.md +1 -1
- package/src/core/location/location.spec.js +9 -9
- package/src/core/sanitize/sanitize-uri.spec.js +1 -1
- package/src/core/sce/sce.spec.js +3 -3
- package/src/core/scope/scope.spec.js +1 -1
- package/src/core/url-utils/url-utils.js +4 -4
- package/src/core/url-utils/url-utils.spec.js +1 -1
- package/src/directive/attrs/boolean.spec.js +1 -1
- package/src/directive/class/class.js +10 -90
- package/src/directive/class/class.md +90 -0
- package/src/directive/class/class.spec.js +1 -1
- package/src/directive/controller/controller.spec.js +0 -12
- package/src/directive/form/form.spec.js +3 -3
- package/src/directive/include/include.spec.js +1 -1
- package/src/directive/input/input.js +1 -1
- package/src/directive/model/model.js +50 -42
- package/src/directive/options/options.js +2 -2
- package/src/directive/repeat/repeat.spec.js +4 -4
- package/src/directive/select/select.js +1 -1
- package/src/directive/show-hide/show-hide.spec.js +1 -1
- package/src/directive/style/style.spec.js +1 -1
- package/src/directive/switch/switch.spec.js +1 -1
- package/src/directive/validators/validators.js +2 -2
- package/src/filters/filter.js +2 -3
- package/src/filters/limit-to.js +2 -2
- package/src/router/resolve/resolvable.js +4 -0
- package/src/router/resolve/resolve-context.js +12 -6
- package/src/router/state/state-builder.js +31 -23
- package/src/router/transition/hook-registry.js +2 -2
- package/src/router/transition/transition-hook.js +3 -3
- package/src/services/cookie-reader.js +1 -1
- package/src/services/http/http.js +24 -19
- package/src/shared/common.js +2 -2
- package/src/shared/common.spec.js +5 -7
- package/src/shared/hof.js +1 -2
- package/src/shared/jqlite/jqlite.js +26 -28
- package/src/shared/jqlite/jqlite.spec.js +10 -10
- package/src/shared/utils.js +6 -38
- package/types/core/controller/controller.d.ts +29 -5
- package/types/core/di/internal-injector.d.ts +6 -6
- package/types/core/di/ng-module.d.ts +2 -2
- package/types/directive/class/class.d.ts +3 -100
- package/types/directive/model/model.d.ts +6 -3
- package/types/directive/validators/validators.d.ts +2 -2
- package/types/router/resolve/resolve-context.d.ts +9 -6
- package/types/shared/common.d.ts +0 -2
- package/types/shared/hof.d.ts +0 -1
- package/types/shared/jqlite/jqlite.d.ts +4 -4
- package/types/shared/utils.d.ts +5 -13
|
@@ -65,7 +65,7 @@ describe("urlUtils", () => {
|
|
|
65
65
|
|
|
66
66
|
expectIsSameOrigin("path", true);
|
|
67
67
|
|
|
68
|
-
const origin = urlResolve(
|
|
68
|
+
const origin = urlResolve(document.location.href);
|
|
69
69
|
expectIsSameOrigin(`//${origin.host}/path`, true);
|
|
70
70
|
|
|
71
71
|
// Different domain.
|
|
@@ -10,7 +10,7 @@ describe("boolean attr directives", () => {
|
|
|
10
10
|
createInjector([
|
|
11
11
|
"ng",
|
|
12
12
|
($provide) => {
|
|
13
|
-
$provide.value("$rootElement",
|
|
13
|
+
$provide.value("$rootElement", document.body);
|
|
14
14
|
},
|
|
15
15
|
]).invoke((_$compile_, _$rootScope_, _$rootElement_) => {
|
|
16
16
|
$compile = _$compile_;
|
|
@@ -6,8 +6,18 @@ function classDirective(name, selector) {
|
|
|
6
6
|
|
|
7
7
|
return [
|
|
8
8
|
"$parse",
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* @param {import("../../core/parser/parse.js").ParseService} $parse
|
|
12
|
+
* @returns {import("../../types").Directive}
|
|
13
|
+
*/
|
|
9
14
|
($parse) => ({
|
|
10
15
|
restrict: "EA",
|
|
16
|
+
/**
|
|
17
|
+
* @param {import("../../core/scope/scope").Scope} scope
|
|
18
|
+
* @param {import("../../shared/jqlite/jqlite").JQLite} element
|
|
19
|
+
* @param {import("../../core/compile/attributes").Attributes} attr
|
|
20
|
+
*/
|
|
11
21
|
link(scope, element, attr) {
|
|
12
22
|
let classCounts = element.data("$classCounts");
|
|
13
23
|
let oldModulo = true;
|
|
@@ -165,96 +175,6 @@ function classDirective(name, selector) {
|
|
|
165
175
|
}
|
|
166
176
|
}
|
|
167
177
|
|
|
168
|
-
/**
|
|
169
|
-
* The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding
|
|
170
|
-
* an expression that represents all classes to be added.
|
|
171
|
-
*
|
|
172
|
-
* The directive operates in three different ways, depending on which of three types the expression
|
|
173
|
-
* evaluates to:
|
|
174
|
-
*
|
|
175
|
-
* 1. If the expression evaluates to a string, the string should be one or more space-delimited class
|
|
176
|
-
* names.
|
|
177
|
-
*
|
|
178
|
-
* 2. If the expression evaluates to an object, then for each key-value pair of the
|
|
179
|
-
* object with a truthy value the corresponding key is used as a class name.
|
|
180
|
-
*
|
|
181
|
-
* 3. If the expression evaluates to an array, each element of the array should either be a string as in
|
|
182
|
-
* type 1 or an object as in type 2. This means that you can mix strings and objects together in an array
|
|
183
|
-
* to give you more control over what CSS classes appear. See the code below for an example of this.
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
* The directive won't add duplicate classes if a particular class was already set.
|
|
187
|
-
*
|
|
188
|
-
* When the expression changes, the previously added classes are removed and only then are the
|
|
189
|
-
* new classes added.
|
|
190
|
-
*
|
|
191
|
-
* @knownIssue
|
|
192
|
-
* You should not use {@link guide/interpolation interpolation} in the value of the `class`
|
|
193
|
-
* attribute, when using the `ngClass` directive on the same element.
|
|
194
|
-
* See {@link guide/interpolation#known-issues here} for more info.
|
|
195
|
-
*
|
|
196
|
-
* @animations
|
|
197
|
-
* | Animation | Occurs |
|
|
198
|
-
* |----------------------------------|-------------------------------------|
|
|
199
|
-
* | {@link ng.$animate#addClass addClass} | just before the class is applied to the element |
|
|
200
|
-
* | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |
|
|
201
|
-
* | {@link ng.$animate#setClass setClass} | just before classes are added and classes are removed from the element at the same time |
|
|
202
|
-
*
|
|
203
|
-
* ### ngClass and pre-existing CSS3 Transitions/Animations
|
|
204
|
-
The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
|
|
205
|
-
Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder
|
|
206
|
-
any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure
|
|
207
|
-
to view the step by step details of {@link $animate#addClass $animate.addClass} and
|
|
208
|
-
{@link $animate#removeClass $animate.removeClass}.
|
|
209
|
-
*
|
|
210
|
-
* @param {String} ngClass {@link guide/expression Expression} to eval. The result
|
|
211
|
-
* of the evaluation can be a string representing space delimited class
|
|
212
|
-
* names, an array, or a map of class names to boolean values. In the case of a map, the
|
|
213
|
-
* names of the properties whose values are truthy will be added as css classes to the
|
|
214
|
-
* element.
|
|
215
|
-
*
|
|
216
|
-
*/
|
|
217
178
|
export const ngClassDirective = classDirective("", true);
|
|
218
|
-
|
|
219
|
-
/**
|
|
220
|
-
* The `ngClassOdd` and `ngClassEven` directives work exactly as
|
|
221
|
-
* {@link ng.directive:ngClass ngClass}, except they work in
|
|
222
|
-
* conjunction with `ngRepeat` and take effect only on odd (even) rows.
|
|
223
|
-
*
|
|
224
|
-
* This directive can be applied only within the scope of an
|
|
225
|
-
* {@link ng.directive:ngRepeat ngRepeat}.
|
|
226
|
-
*
|
|
227
|
-
* @animations
|
|
228
|
-
* | Animation | Occurs |
|
|
229
|
-
* |----------------------------------|-------------------------------------|
|
|
230
|
-
* | {@link ng.$animate#addClass addClass} | just before the class is applied to the element |
|
|
231
|
-
* | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |
|
|
232
|
-
*
|
|
233
|
-
* @element ANY
|
|
234
|
-
* @param {String} ngClassOdd {@link guide/expression Expression} to eval. The result
|
|
235
|
-
* of the evaluation can be a string representing space delimited class names or an array.
|
|
236
|
-
*
|
|
237
|
-
*
|
|
238
|
-
*/
|
|
239
179
|
export const ngClassOddDirective = classDirective("Odd", 0);
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* The `ngClassOdd` and `ngClassEven` directives work exactly as
|
|
243
|
-
* {@link ng.directive:ngClass ngClass}, except they work in
|
|
244
|
-
* conjunction with `ngRepeat` and take effect only on odd (even) rows.
|
|
245
|
-
*
|
|
246
|
-
* This directive can be applied only within the scope of an
|
|
247
|
-
* {@link ng.directive:ngRepeat ngRepeat}.
|
|
248
|
-
*
|
|
249
|
-
* @animations
|
|
250
|
-
* | Animation | Occurs |
|
|
251
|
-
* |----------------------------------|-------------------------------------|
|
|
252
|
-
* | {@link ng.$animate#addClass addClass} | just before the class is applied to the element |
|
|
253
|
-
* | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |
|
|
254
|
-
*
|
|
255
|
-
* @element ANY
|
|
256
|
-
* @param {String} ngClassEven {@link guide/expression Expression} to eval. The
|
|
257
|
-
* result of the evaluation can be a string representing space delimited class names or an array.
|
|
258
|
-
*
|
|
259
|
-
*/
|
|
260
180
|
export const ngClassEvenDirective = classDirective("Even", 1);
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/\*\*
|
|
2
|
+
|
|
3
|
+
- The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding
|
|
4
|
+
- an expression that represents all classes to be added.
|
|
5
|
+
-
|
|
6
|
+
- The directive operates in three different ways, depending on which of three types the expression
|
|
7
|
+
- evaluates to:
|
|
8
|
+
-
|
|
9
|
+
- 1. If the expression evaluates to a string, the string should be one or more space-delimited class
|
|
10
|
+
- names.
|
|
11
|
+
-
|
|
12
|
+
- 2. If the expression evaluates to an object, then for each key-value pair of the
|
|
13
|
+
- object with a truthy value the corresponding key is used as a class name.
|
|
14
|
+
-
|
|
15
|
+
- 3. If the expression evaluates to an array, each element of the array should either be a string as in
|
|
16
|
+
- type 1 or an object as in type 2. This means that you can mix strings and objects together in an array
|
|
17
|
+
- to give you more control over what CSS classes appear. See the code below for an example of this.
|
|
18
|
+
-
|
|
19
|
+
-
|
|
20
|
+
- The directive won't add duplicate classes if a particular class was already set.
|
|
21
|
+
-
|
|
22
|
+
- When the expression changes, the previously added classes are removed and only then are the
|
|
23
|
+
- new classes added.
|
|
24
|
+
-
|
|
25
|
+
- @knownIssue
|
|
26
|
+
- You should not use {@link guide/interpolation interpolation} in the value of the `class`
|
|
27
|
+
- attribute, when using the `ngClass` directive on the same element.
|
|
28
|
+
- See {@link guide/interpolation#known-issues here} for more info.
|
|
29
|
+
-
|
|
30
|
+
- @animations
|
|
31
|
+
- | Animation | Occurs |
|
|
32
|
+
- |----------------------------------|-------------------------------------|
|
|
33
|
+
- | {@link ng.$animate#addClass addClass} | just before the class is applied to the element |
|
|
34
|
+
- | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |
|
|
35
|
+
- | {@link ng.$animate#setClass setClass} | just before classes are added and classes are removed from the element at the same time |
|
|
36
|
+
-
|
|
37
|
+
- ### ngClass and pre-existing CSS3 Transitions/Animations
|
|
38
|
+
The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
|
|
39
|
+
Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder
|
|
40
|
+
any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure
|
|
41
|
+
to view the step by step details of {@link $animate#addClass $animate.addClass} and
|
|
42
|
+
{@link $animate#removeClass $animate.removeClass}.
|
|
43
|
+
-
|
|
44
|
+
- @param {String} ngClass {@link guide/expression Expression} to eval. The result
|
|
45
|
+
- of the evaluation can be a string representing space delimited class
|
|
46
|
+
- names, an array, or a map of class names to boolean values. In the case of a map, the
|
|
47
|
+
- names of the properties whose values are truthy will be added as css classes to the
|
|
48
|
+
- element.
|
|
49
|
+
- \*/
|
|
50
|
+
|
|
51
|
+
/\*\*
|
|
52
|
+
|
|
53
|
+
- The `ngClassOdd` and `ngClassEven` directives work exactly as
|
|
54
|
+
- {@link ng.directive:ngClass ngClass}, except they work in
|
|
55
|
+
- conjunction with `ngRepeat` and take effect only on odd (even) rows.
|
|
56
|
+
-
|
|
57
|
+
- This directive can be applied only within the scope of an
|
|
58
|
+
- {@link ng.directive:ngRepeat ngRepeat}.
|
|
59
|
+
-
|
|
60
|
+
- @animations
|
|
61
|
+
- | Animation | Occurs |
|
|
62
|
+
- |----------------------------------|-------------------------------------|
|
|
63
|
+
- | {@link ng.$animate#addClass addClass} | just before the class is applied to the element |
|
|
64
|
+
- | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |
|
|
65
|
+
-
|
|
66
|
+
- @element ANY
|
|
67
|
+
- @param {string} ngClassOdd {@link guide/expression Expression} to eval. The result
|
|
68
|
+
- of the evaluation can be a string representing space delimited class names or an array.
|
|
69
|
+
-
|
|
70
|
+
- \*/
|
|
71
|
+
|
|
72
|
+
/\*\*
|
|
73
|
+
|
|
74
|
+
- The `ngClassOdd` and `ngClassEven` directives work exactly as
|
|
75
|
+
- {@link ng.directive:ngClass ngClass}, except they work in
|
|
76
|
+
- conjunction with `ngRepeat` and take effect only on odd (even) rows.
|
|
77
|
+
-
|
|
78
|
+
- This directive can be applied only within the scope of an
|
|
79
|
+
- {@link ng.directive:ngRepeat ngRepeat}.
|
|
80
|
+
-
|
|
81
|
+
- @animations
|
|
82
|
+
- | Animation | Occurs |
|
|
83
|
+
- |----------------------------------|-------------------------------------|
|
|
84
|
+
- | {@link ng.$animate#addClass addClass} | just before the class is applied to the element |
|
|
85
|
+
- | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |
|
|
86
|
+
-
|
|
87
|
+
- @element ANY
|
|
88
|
+
- @param {string} ngClassEven {@link guide/expression Expression} to eval. The
|
|
89
|
+
- result of the evaluation can be a string representing space delimited class names or an array.
|
|
90
|
+
- \*/
|
|
@@ -737,7 +737,7 @@ describe("ngClass", () => {
|
|
|
737
737
|
// module("ngAnimateMock");
|
|
738
738
|
// inject(($compile, $rootScope, $animate, $timeout) => {
|
|
739
739
|
// element = angular.element('<div ng-class="val"></div>');
|
|
740
|
-
// const body = JQLite(
|
|
740
|
+
// const body = JQLite(document.body);
|
|
741
741
|
// body.append(element);
|
|
742
742
|
// $compile(element)($rootScope);
|
|
743
743
|
|
|
@@ -112,18 +112,6 @@ describe("ngController", () => {
|
|
|
112
112
|
expect(element.text()).toBe("Hello Adam!");
|
|
113
113
|
});
|
|
114
114
|
|
|
115
|
-
it("should instantiate controller defined on scope", () => {
|
|
116
|
-
$rootScope.VojtaGreeter = function ($scope) {
|
|
117
|
-
$scope.name = "Vojta";
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
element = $compile('<div ng-controller="VojtaGreeter">{{name}}</div>')(
|
|
121
|
-
$rootScope,
|
|
122
|
-
);
|
|
123
|
-
$rootScope.$digest();
|
|
124
|
-
expect(element.text()).toBe("Vojta");
|
|
125
|
-
});
|
|
126
|
-
|
|
127
115
|
it("should work with ngInclude on the same element", (done) => {
|
|
128
116
|
element = JQLite(
|
|
129
117
|
'<div><div ng-controller="Greeter" ng-include="\'/mock/interpolation\'"></div></div>',
|
|
@@ -419,7 +419,7 @@ describe("form", () => {
|
|
|
419
419
|
);
|
|
420
420
|
// Support: Chrome 60+ (on Windows)
|
|
421
421
|
// We need to add the form to the DOM in order for `submit` events to be properly fired.
|
|
422
|
-
|
|
422
|
+
document.body.appendChild(doc[0]);
|
|
423
423
|
|
|
424
424
|
const assertPreventDefaultListener = function (e) {
|
|
425
425
|
reloadPrevented = e.defaultPrevented || e.returnValue === false;
|
|
@@ -1404,7 +1404,7 @@ describe("form", () => {
|
|
|
1404
1404
|
let myModule;
|
|
1405
1405
|
|
|
1406
1406
|
beforeEach(() => {
|
|
1407
|
-
let dummy =
|
|
1407
|
+
let dummy = document.getElementById("dummy");
|
|
1408
1408
|
doc = JQLite('<form name="myForm"></form>');
|
|
1409
1409
|
JQLite(dummy).append(doc);
|
|
1410
1410
|
let angular = new Angular();
|
|
@@ -1423,7 +1423,7 @@ describe("form", () => {
|
|
|
1423
1423
|
afterEach(() => {
|
|
1424
1424
|
dealoc(doc);
|
|
1425
1425
|
dealoc(dummy);
|
|
1426
|
-
|
|
1426
|
+
document.getElementById("dummy").innerHTML = "";
|
|
1427
1427
|
});
|
|
1428
1428
|
|
|
1429
1429
|
it("should trigger an animation when invalid", (done) => {
|
|
@@ -689,7 +689,7 @@ describe("ngInclude", () => {
|
|
|
689
689
|
// // // we need to run animation on attached elements;
|
|
690
690
|
// // function (_$rootElement_) {
|
|
691
691
|
// // $rootElement = _$rootElement_;
|
|
692
|
-
// // body = JQLite(
|
|
692
|
+
// // body = JQLite(document.body);
|
|
693
693
|
// // body.append($rootElement);
|
|
694
694
|
// // },
|
|
695
695
|
// // ),
|
|
@@ -113,7 +113,7 @@ function textInputType(scope, element, attr, ctrl, $browser) {
|
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
function baseInputType(scope, element, attr, ctrl, $browser) {
|
|
116
|
-
const type =
|
|
116
|
+
const type = element[0].type.toLowerCase();
|
|
117
117
|
let composing = false;
|
|
118
118
|
// In composition mode, users are still inputting intermediate text buffer,
|
|
119
119
|
// hold the listener until composition is done.
|
|
@@ -146,17 +146,23 @@ export class NgModelController {
|
|
|
146
146
|
|
|
147
147
|
this.$$parsedNgModel = $parse($attr["ngModel"]);
|
|
148
148
|
this.$$parsedNgModelAssign = this.$$parsedNgModel.assign;
|
|
149
|
+
|
|
149
150
|
/** @type {import("../../core/parser/parse").CompiledExpression|((Scope) => any)} */
|
|
150
151
|
this.$$ngModelGet = this.$$parsedNgModel;
|
|
151
152
|
this.$$ngModelSet = this.$$parsedNgModelAssign;
|
|
152
153
|
this.$$pendingDebounce = null;
|
|
153
154
|
this.$$parserValid = undefined;
|
|
155
|
+
|
|
156
|
+
/** @type {string} */
|
|
154
157
|
this.$$parserName = "parse";
|
|
155
158
|
|
|
156
159
|
/** @type {number} */
|
|
157
160
|
this.$$currentValidationRunId = 0;
|
|
158
161
|
|
|
162
|
+
/** @type {import('../../core/scope/scope.js').Scope} */
|
|
159
163
|
this.$$scope = $scope;
|
|
164
|
+
|
|
165
|
+
/** @type {import('../../core/scope/scope.js').Scope} */
|
|
160
166
|
this.$$rootScope = $scope.$root;
|
|
161
167
|
this.$$attr = $attr;
|
|
162
168
|
this.$$element = $element;
|
|
@@ -1095,54 +1101,56 @@ export function ngModelDirective($rootScope) {
|
|
|
1095
1101
|
// so that we can set the NgModelOptions in NgModelController
|
|
1096
1102
|
// before anyone else uses it.
|
|
1097
1103
|
priority: 1,
|
|
1098
|
-
compile:
|
|
1099
|
-
|
|
1100
|
-
element
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1104
|
+
compile:
|
|
1105
|
+
/** @param {import("../../shared/jqlite/jqlite.js").JQLite} element */
|
|
1106
|
+
(element) => {
|
|
1107
|
+
// Setup initial state of the control
|
|
1108
|
+
element[0].classList.add(PRISTINE_CLASS, UNTOUCHED_CLASS, VALID_CLASS);
|
|
1109
|
+
|
|
1110
|
+
return {
|
|
1111
|
+
pre: (scope, _element, attr, ctrls) => {
|
|
1112
|
+
const modelCtrl = ctrls[0];
|
|
1113
|
+
const formCtrl = ctrls[1] || modelCtrl.$$parentForm;
|
|
1114
|
+
const optionsCtrl = ctrls[2];
|
|
1115
|
+
|
|
1116
|
+
if (optionsCtrl) {
|
|
1117
|
+
modelCtrl.$options = optionsCtrl.$options;
|
|
1118
|
+
}
|
|
1111
1119
|
|
|
1112
|
-
|
|
1120
|
+
modelCtrl.$$initGetterSetters();
|
|
1113
1121
|
|
|
1114
|
-
|
|
1115
|
-
|
|
1122
|
+
// notify others, especially parent forms
|
|
1123
|
+
formCtrl.$addControl(modelCtrl);
|
|
1116
1124
|
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1125
|
+
attr.$observe("name", (newValue) => {
|
|
1126
|
+
if (modelCtrl.$name !== newValue) {
|
|
1127
|
+
modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1122
1130
|
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1131
|
+
scope.$on("$destroy", () => {
|
|
1132
|
+
modelCtrl.$$parentForm.$removeControl(modelCtrl);
|
|
1133
|
+
});
|
|
1134
|
+
},
|
|
1135
|
+
post: (scope, element, _attr, ctrls) => {
|
|
1136
|
+
const modelCtrl = ctrls[0];
|
|
1137
|
+
modelCtrl.$$setUpdateOnEvents();
|
|
1130
1138
|
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1139
|
+
function setTouched() {
|
|
1140
|
+
modelCtrl.$setTouched();
|
|
1141
|
+
}
|
|
1134
1142
|
|
|
1135
|
-
|
|
1136
|
-
|
|
1143
|
+
element.on("blur", () => {
|
|
1144
|
+
if (modelCtrl.$touched) return;
|
|
1137
1145
|
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1146
|
+
if ($rootScope.$$phase !== ScopePhase.NONE) {
|
|
1147
|
+
scope.$evalAsync(setTouched);
|
|
1148
|
+
} else {
|
|
1149
|
+
scope.$apply(setTouched);
|
|
1150
|
+
}
|
|
1151
|
+
});
|
|
1152
|
+
},
|
|
1153
|
+
};
|
|
1154
|
+
},
|
|
1147
1155
|
};
|
|
1148
1156
|
}
|
|
@@ -209,8 +209,8 @@ export const ngOptionsDirective = [
|
|
|
209
209
|
// Support: IE 9 only
|
|
210
210
|
// We can't just JQLite('<option>') since JQLite is not smart enough
|
|
211
211
|
// to create it in <select> and IE barfs otherwise.
|
|
212
|
-
const optionTemplate =
|
|
213
|
-
const optGroupTemplate =
|
|
212
|
+
const optionTemplate = document.createElement("option");
|
|
213
|
+
const optGroupTemplate = document.createElement("optgroup");
|
|
214
214
|
|
|
215
215
|
function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
|
|
216
216
|
const selectCtrl = ctrls[0];
|
|
@@ -119,7 +119,7 @@ describe("ngRepeat", () => {
|
|
|
119
119
|
"<a class='test' name='y'>b</a>" +
|
|
120
120
|
"<a class='test' name='x'>c</a>";
|
|
121
121
|
|
|
122
|
-
const htmlCollection =
|
|
122
|
+
const htmlCollection = document.getElementsByClassName("test");
|
|
123
123
|
scope.items = htmlCollection;
|
|
124
124
|
scope.$digest();
|
|
125
125
|
expect(element.find("li").length).toEqual(3);
|
|
@@ -382,7 +382,7 @@ describe("ngRepeat", () => {
|
|
|
382
382
|
"</li>" +
|
|
383
383
|
"</ul>",
|
|
384
384
|
)(scope);
|
|
385
|
-
|
|
385
|
+
document.getElementById("dummy").appendChild(element[0]);
|
|
386
386
|
scope.items = { misko: true, shyam: true, zhenbo: true };
|
|
387
387
|
scope.$digest();
|
|
388
388
|
expect(element.find("li").length).toEqual(3);
|
|
@@ -413,7 +413,7 @@ describe("ngRepeat", () => {
|
|
|
413
413
|
expect(element.find("input")[1].checked).toBe(true);
|
|
414
414
|
expect(element.find("input")[2].checked).toBe(true);
|
|
415
415
|
|
|
416
|
-
|
|
416
|
+
document.getElementById("dummy").innerHTML = "";
|
|
417
417
|
});
|
|
418
418
|
|
|
419
419
|
it("should invoke track by with correct locals", () => {
|
|
@@ -1466,7 +1466,7 @@ describe("ngRepeat", () => {
|
|
|
1466
1466
|
// // we need to run animation on attached elements;
|
|
1467
1467
|
// function (_$rootElement_) {
|
|
1468
1468
|
// $rootElement = _$rootElement_;
|
|
1469
|
-
// body = JQLite(
|
|
1469
|
+
// body = JQLite(document.body);
|
|
1470
1470
|
// body.append($rootElement);
|
|
1471
1471
|
// },
|
|
1472
1472
|
// ),
|
|
@@ -49,7 +49,7 @@ function SelectController($element, $scope) {
|
|
|
49
49
|
// Support: IE 9 only
|
|
50
50
|
// We can't just JQLite('<option>') since JQLite is not smart enough
|
|
51
51
|
// to create it in <select> and IE barfs otherwise.
|
|
52
|
-
self.unknownOption = JQLite(
|
|
52
|
+
self.unknownOption = JQLite(document.createElement("option"));
|
|
53
53
|
|
|
54
54
|
// The empty option is an option with the value '' that the application developer can
|
|
55
55
|
// provide inside the select. It is always selectable and indicates that a "null" selection has
|
|
@@ -86,7 +86,7 @@ describe("ng-style", () => {
|
|
|
86
86
|
postCompVal = "100px";
|
|
87
87
|
element = JQLite('<div ng-style="styleObj"></div>');
|
|
88
88
|
element[0].style[preCompStyle] = preCompVal;
|
|
89
|
-
JQLite(
|
|
89
|
+
JQLite(document.body).append(element);
|
|
90
90
|
$compile(element)($scope);
|
|
91
91
|
scope = $scope;
|
|
92
92
|
scope.styleObj = { "margin-top": "44px" };
|
|
@@ -499,7 +499,7 @@ describe("ngSwitch", () => {
|
|
|
499
499
|
// // we need to run animation on attached elements;
|
|
500
500
|
// function (_$rootElement_) {
|
|
501
501
|
// $rootElement = _$rootElement_;
|
|
502
|
-
// body = JQLite(
|
|
502
|
+
// body = JQLite(document.body);
|
|
503
503
|
// body.append($rootElement);
|
|
504
504
|
// },
|
|
505
505
|
// ),
|
|
@@ -10,7 +10,7 @@ import { startingTag } from "../../shared/jqlite/jqlite";
|
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
*
|
|
13
|
-
* @param {
|
|
13
|
+
* @param {string} ngRequired AngularJS expression. If it evaluates to `true`, it sets the
|
|
14
14
|
* `required` attribute to the element and adds the `required`
|
|
15
15
|
* {@link ngModel.NgModelController#$validators `validator`}.
|
|
16
16
|
*
|
|
@@ -170,7 +170,7 @@ export const patternDirective = [
|
|
|
170
170
|
];
|
|
171
171
|
|
|
172
172
|
/**
|
|
173
|
-
* @param {
|
|
173
|
+
* @param {string} ngMaxlength AngularJS expression that must evaluate to a `Number` or `String`
|
|
174
174
|
* parsable into a `Number`. Used as value for the `maxlength`
|
|
175
175
|
* {@link ngModel.NgModelController#$validators validator}.
|
|
176
176
|
*
|
package/src/filters/filter.js
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
isFunction,
|
|
5
5
|
isUndefined,
|
|
6
6
|
isObject,
|
|
7
|
-
lowercase,
|
|
8
7
|
hasCustomToString,
|
|
9
8
|
equals,
|
|
10
9
|
} from "../shared/utils";
|
|
@@ -95,8 +94,8 @@ function createPredicateFn(
|
|
|
95
94
|
return false;
|
|
96
95
|
}
|
|
97
96
|
|
|
98
|
-
actual =
|
|
99
|
-
expected =
|
|
97
|
+
actual = `${actual}`.toLowerCase();
|
|
98
|
+
expected = `${expected}`.toLowerCase();
|
|
100
99
|
return actual.indexOf(expected) !== -1;
|
|
101
100
|
};
|
|
102
101
|
}
|
package/src/filters/limit-to.js
CHANGED
|
@@ -19,7 +19,7 @@ export function limitToFilter() {
|
|
|
19
19
|
if (Math.abs(Number(limit)) === Infinity) {
|
|
20
20
|
limit = Number(limit);
|
|
21
21
|
} else {
|
|
22
|
-
limit = toInt(/** @type {
|
|
22
|
+
limit = toInt(/** @type {string} */ (limit));
|
|
23
23
|
}
|
|
24
24
|
if (isNumberNaN(limit)) return input;
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ export function limitToFilter() {
|
|
|
29
29
|
begin =
|
|
30
30
|
!begin || isNaN(/** @type {any} */ (begin))
|
|
31
31
|
? 0
|
|
32
|
-
: toInt(/** @type {
|
|
32
|
+
: toInt(/** @type {string} */ (begin));
|
|
33
33
|
begin =
|
|
34
34
|
begin < 0 ? Math.max(0, /** @type {[]} */ (input).length + begin) : begin;
|
|
35
35
|
|
|
@@ -48,6 +48,7 @@ export class Resolvable {
|
|
|
48
48
|
this.data = arg1.data;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
+
|
|
51
52
|
getPolicy(state) {
|
|
52
53
|
const thisPolicy = this.policy || {};
|
|
53
54
|
const statePolicy = (state && state.resolvePolicy) || {};
|
|
@@ -57,6 +58,7 @@ export class Resolvable {
|
|
|
57
58
|
thisPolicy.async || statePolicy.async || defaultResolvePolicy.async,
|
|
58
59
|
};
|
|
59
60
|
}
|
|
61
|
+
|
|
60
62
|
/**
|
|
61
63
|
* Asynchronously resolve this Resolvable's data
|
|
62
64
|
*
|
|
@@ -105,9 +107,11 @@ export class Resolvable {
|
|
|
105
107
|
get(resolveContext, trans) {
|
|
106
108
|
return this.promise || this.resolve(resolveContext, trans);
|
|
107
109
|
}
|
|
110
|
+
|
|
108
111
|
toString() {
|
|
109
112
|
return `Resolvable(token: ${stringify(this.token)}, requires: [${this.deps.map(stringify)}])`;
|
|
110
113
|
}
|
|
114
|
+
|
|
111
115
|
clone() {
|
|
112
116
|
return new Resolvable(this);
|
|
113
117
|
}
|