@angular-wave/angular.ts 0.8.0 → 0.8.2
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/@types/angular.d.ts +3 -3
- package/@types/core/compile/compile.d.ts +5 -2
- package/@types/core/di/ng-module.d.ts +61 -25
- package/@types/interface.d.ts +1 -1
- package/@types/router/directives/state-directives.d.ts +2 -2
- package/@types/router/directives/view-directive.d.ts +1 -1
- package/@types/router/params/param-type.d.ts +0 -1
- package/@types/router/{globals.d.ts → router.d.ts} +1 -1
- package/@types/router/state/state-registry.d.ts +2 -2
- package/@types/router/state/state-service.d.ts +6 -9
- package/@types/router/transition/transition-service.d.ts +3 -3
- package/@types/router/transition/transition.d.ts +4 -4
- package/@types/router/url/url-matcher.d.ts +0 -1
- package/@types/router/url/url-rule.d.ts +13 -4
- package/@types/router/url/url-service.d.ts +2 -2
- package/@types/shared/hof.d.ts +0 -6
- package/CHANGELOG.md +0 -72
- package/CONTRIBUTING.md +0 -1
- package/DEVELOPERS.md +0 -1
- package/TRIAGING.md +0 -1
- package/dist/angular-ts.esm.js +103 -103
- package/dist/angular-ts.umd.js +103 -103
- package/dist/angular-ts.umd.min.js +1 -1
- package/docs/layouts/shortcodes/version.html +1 -1
- package/docs/static/typedoc/assets/hierarchy.js +1 -1
- package/docs/static/typedoc/assets/navigation.js +1 -1
- package/docs/static/typedoc/assets/search.js +1 -1
- package/docs/static/typedoc/assets/style.css +2 -9
- package/docs/static/typedoc/classes/NgModule.html +3 -3
- package/docs/static/typedoc/types/Injectable.html +4 -1
- package/docs/static/typedoc/types/InjectableFactory.html +1 -4
- package/package.json +2 -2
- package/src/angular.js +10 -10
- package/src/angular.spec.js +4 -4
- package/src/core/compile/compile.js +1 -1
- package/src/core/di/ng-module.js +26 -21
- package/src/core/parse/parse.spec.js +29 -30
- package/src/directive/events/event.spec.js +5 -5
- package/src/directive/messages/messages.md +0 -4
- package/src/directive/repeat/repeat.js +1 -1
- package/src/injection-tokens.js +2 -2
- package/src/interface.ts +1 -2
- package/src/ng.js +5 -5
- package/src/ng.spec.js +1 -1
- package/src/router/directives/state-directives.js +5 -5
- package/src/router/directives/state-directives.spec.js +2 -2
- package/src/router/directives/view-directive.js +5 -5
- package/src/router/directives/view-directive.spec.js +20 -20
- package/src/router/params/param-type.js +0 -1
- package/src/router/params/param.js +1 -1
- package/src/router/{globals.js → router.js} +1 -1
- package/src/router/services.spec.js +3 -3
- package/src/router/state/state-registry.js +2 -2
- package/src/router/state/state-service.js +5 -8
- package/src/router/template-factory.spec.js +6 -6
- package/src/router/transition/transition-service.js +2 -2
- package/src/router/transition/transition.js +2 -2
- package/src/router/url/url-matcher.js +9 -11
- package/src/router/url/url-rule.js +7 -2
- package/src/router/url/url-service.js +6 -3
- package/src/router/url/url-service.spec.js +6 -39
- package/src/router/view-scroll.js +3 -1
- package/src/router/view-scroll.spec.js +11 -11
- package/src/services/location/location.js +9 -2
- package/src/services/location/location.spec.js +6 -0
- package/src/shared/common.js +5 -5
- package/src/shared/hof.js +0 -14
- package/src/shared/min-err.spec.js +1 -1
- package/src/shared/url-utils/url-utils.spec.js +0 -1
- package/src/shared/utils.spec.js +4 -4
- package/tsconfig.json +1 -7
|
@@ -333,7 +333,7 @@ export class CompileProvider {
|
|
|
333
333
|
/**
|
|
334
334
|
* @param {string|Object} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`),
|
|
335
335
|
* or an object map of components where the keys are the names and the values are the component definition objects.
|
|
336
|
-
* @param {
|
|
336
|
+
* @param {import("../../interface.js").ComponentOptions} options Component definition object (a simplified
|
|
337
337
|
* {directive definition object}),
|
|
338
338
|
* with the following properties (all optional):
|
|
339
339
|
*
|
package/src/core/di/ng-module.js
CHANGED
|
@@ -26,7 +26,7 @@ export class NgModule {
|
|
|
26
26
|
/**
|
|
27
27
|
* @param {string} name - Name of the module
|
|
28
28
|
* @param {Array<string>} requires - List of modules which the injector will load before the current module
|
|
29
|
-
* @param {
|
|
29
|
+
* @param {import("../../interface.js").Injectable} [configFn]
|
|
30
30
|
*/
|
|
31
31
|
constructor(name, requires, configFn) {
|
|
32
32
|
assert(isString(name), "name required");
|
|
@@ -52,7 +52,7 @@ export class NgModule {
|
|
|
52
52
|
/** @type {!Array<Array<*>>} */
|
|
53
53
|
this.configBlocks = [];
|
|
54
54
|
|
|
55
|
-
/** @type {!Array.<
|
|
55
|
+
/** @type {!Array.<import("../../interface.js").Injectable>} */
|
|
56
56
|
this.runBlocks = [];
|
|
57
57
|
|
|
58
58
|
if (configFn) {
|
|
@@ -82,7 +82,7 @@ export class NgModule {
|
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
*
|
|
85
|
-
* @param {
|
|
85
|
+
* @param {import("../../interface.js").Injectable} configFn
|
|
86
86
|
* @returns {NgModule}
|
|
87
87
|
*/
|
|
88
88
|
config(configFn) {
|
|
@@ -91,7 +91,7 @@ export class NgModule {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
/**
|
|
94
|
-
* @param {
|
|
94
|
+
* @param {import("../../interface.js").Injectable} block
|
|
95
95
|
* @returns {NgModule}
|
|
96
96
|
*/
|
|
97
97
|
run(block) {
|
|
@@ -101,12 +101,12 @@ export class NgModule {
|
|
|
101
101
|
|
|
102
102
|
/**
|
|
103
103
|
* @param {string} name
|
|
104
|
-
* @param {
|
|
104
|
+
* @param {import("../../interface.js").ComponentOptions} options
|
|
105
105
|
* @returns {NgModule}
|
|
106
106
|
*/
|
|
107
107
|
component(name, options) {
|
|
108
108
|
if (options && isFunction(options)) {
|
|
109
|
-
options
|
|
109
|
+
options["$$moduleName"] = name;
|
|
110
110
|
}
|
|
111
111
|
this.invokeQueue.push([COMPILE_LITERAL, "component", [name, options]]);
|
|
112
112
|
return this;
|
|
@@ -114,12 +114,12 @@ export class NgModule {
|
|
|
114
114
|
|
|
115
115
|
/**
|
|
116
116
|
* @param {string} name
|
|
117
|
-
* @param {
|
|
117
|
+
* @param {import("../../interface.js").Injectable} providerFunction
|
|
118
118
|
* @returns {NgModule}
|
|
119
119
|
*/
|
|
120
120
|
factory(name, providerFunction) {
|
|
121
121
|
if (providerFunction && isFunction(providerFunction)) {
|
|
122
|
-
providerFunction
|
|
122
|
+
providerFunction["$$moduleName"] = name;
|
|
123
123
|
}
|
|
124
124
|
this.invokeQueue.push([$t.$provide, "factory", [name, providerFunction]]);
|
|
125
125
|
return this;
|
|
@@ -127,12 +127,12 @@ export class NgModule {
|
|
|
127
127
|
|
|
128
128
|
/**
|
|
129
129
|
* @param {string} name
|
|
130
|
-
* @param {
|
|
130
|
+
* @param {import("../../interface.js").Injectable} serviceFunction
|
|
131
131
|
* @returns {NgModule}
|
|
132
132
|
*/
|
|
133
133
|
service(name, serviceFunction) {
|
|
134
134
|
if (serviceFunction && isFunction(serviceFunction)) {
|
|
135
|
-
serviceFunction
|
|
135
|
+
serviceFunction["$$moduleName"] = name;
|
|
136
136
|
}
|
|
137
137
|
this.invokeQueue.push([$t.$provide, "service", [name, serviceFunction]]);
|
|
138
138
|
return this;
|
|
@@ -140,12 +140,12 @@ export class NgModule {
|
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
142
|
* @param {string} name
|
|
143
|
-
* @param {
|
|
143
|
+
* @param {import("../../interface.js").Injectable} providerType
|
|
144
144
|
* @returns {NgModule}
|
|
145
145
|
*/
|
|
146
146
|
provider(name, providerType) {
|
|
147
147
|
if (providerType && isFunction(providerType)) {
|
|
148
|
-
providerType
|
|
148
|
+
providerType["$$moduleName"] = name;
|
|
149
149
|
}
|
|
150
150
|
this.invokeQueue.push([$t.$provide, "provider", [name, providerType]]);
|
|
151
151
|
return this;
|
|
@@ -153,12 +153,12 @@ export class NgModule {
|
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
155
|
* @param {string} name
|
|
156
|
-
* @param {
|
|
156
|
+
* @param {import("../../interface.js").Injectable} decorFn
|
|
157
157
|
* @returns {NgModule}
|
|
158
158
|
*/
|
|
159
159
|
decorator(name, decorFn) {
|
|
160
160
|
if (decorFn && isFunction(decorFn)) {
|
|
161
|
-
decorFn
|
|
161
|
+
decorFn["$$moduleName"] = name;
|
|
162
162
|
}
|
|
163
163
|
this.configBlocks.push([$t.$provide, "decorator", [name, decorFn]]);
|
|
164
164
|
return this;
|
|
@@ -166,12 +166,12 @@ export class NgModule {
|
|
|
166
166
|
|
|
167
167
|
/**
|
|
168
168
|
* @param {string} name
|
|
169
|
-
* @param {
|
|
169
|
+
* @param {import("../../interface.js").Injectable} directiveFactory
|
|
170
170
|
* @returns {NgModule}
|
|
171
171
|
*/
|
|
172
172
|
directive(name, directiveFactory) {
|
|
173
173
|
if (directiveFactory && isFunction(directiveFactory)) {
|
|
174
|
-
directiveFactory
|
|
174
|
+
directiveFactory["$$moduleName"] = name;
|
|
175
175
|
}
|
|
176
176
|
this.invokeQueue.push([
|
|
177
177
|
COMPILE_LITERAL,
|
|
@@ -183,12 +183,12 @@ export class NgModule {
|
|
|
183
183
|
|
|
184
184
|
/**
|
|
185
185
|
* @param {string} name
|
|
186
|
-
* @param {
|
|
186
|
+
* @param {import("../../interface.js").Injectable} animationFactory
|
|
187
187
|
* @returns {NgModule}
|
|
188
188
|
*/
|
|
189
189
|
animation(name, animationFactory) {
|
|
190
190
|
if (animationFactory && isFunction(animationFactory)) {
|
|
191
|
-
animationFactory
|
|
191
|
+
animationFactory["$$moduleName"] = name;
|
|
192
192
|
}
|
|
193
193
|
this.invokeQueue.push([
|
|
194
194
|
ANIMATION_LITERAL,
|
|
@@ -198,9 +198,14 @@ export class NgModule {
|
|
|
198
198
|
return this;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
/**
|
|
202
|
+
* @param {string} name
|
|
203
|
+
* @param {import("../../interface.js").Injectable} filterFn
|
|
204
|
+
* @return {NgModule}
|
|
205
|
+
*/
|
|
201
206
|
filter(name, filterFn) {
|
|
202
207
|
if (filterFn && isFunction(filterFn)) {
|
|
203
|
-
filterFn
|
|
208
|
+
filterFn["$$moduleName"] = name;
|
|
204
209
|
}
|
|
205
210
|
this.invokeQueue.push([FILTER_LITERAL, "register", [name, filterFn]]);
|
|
206
211
|
return this;
|
|
@@ -208,12 +213,12 @@ export class NgModule {
|
|
|
208
213
|
|
|
209
214
|
/**
|
|
210
215
|
* @param {string} name
|
|
211
|
-
* @param {
|
|
216
|
+
* @param {import("../../interface.js").Injectable} ctlFn
|
|
212
217
|
* @returns {NgModule}
|
|
213
218
|
*/
|
|
214
219
|
controller(name, ctlFn) {
|
|
215
220
|
if (ctlFn && isFunction(ctlFn)) {
|
|
216
|
-
ctlFn
|
|
221
|
+
ctlFn["$$moduleName"] = name;
|
|
217
222
|
}
|
|
218
223
|
this.invokeQueue.push([CONTROLLER_LITERAL, "register", [name, ctlFn]]);
|
|
219
224
|
return this;
|
|
@@ -1787,37 +1787,36 @@ describe("parser", () => {
|
|
|
1787
1787
|
});
|
|
1788
1788
|
|
|
1789
1789
|
[0, false, "", NaN].forEach((falsyValue) => {
|
|
1790
|
-
"should not overwrite $prop scope properties when assigning",
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
/* ignore exception */
|
|
1818
|
-
}
|
|
1790
|
+
it("should not overwrite $prop scope properties when assigning", () => {
|
|
1791
|
+
let scope;
|
|
1792
|
+
|
|
1793
|
+
scope = { a: falsyValue, c: falsyValue };
|
|
1794
|
+
tryParseAndIgnoreException("a.b = 1");
|
|
1795
|
+
tryParseAndIgnoreException('c["d"] = 2');
|
|
1796
|
+
expect(scope).toEqual({ a: falsyValue, c: falsyValue });
|
|
1797
|
+
|
|
1798
|
+
scope = { a: { b: falsyValue, c: falsyValue } };
|
|
1799
|
+
tryParseAndIgnoreException("a.b.c = 1");
|
|
1800
|
+
tryParseAndIgnoreException('a.c["d"] = 2');
|
|
1801
|
+
expect(scope).toEqual({ a: { b: falsyValue, c: falsyValue } });
|
|
1802
|
+
|
|
1803
|
+
// Helpers
|
|
1804
|
+
//
|
|
1805
|
+
// Normally assigning property on a primitive should throw exception in strict mode
|
|
1806
|
+
// and silently fail in non-strict mode, IE seems to always have the non-strict-mode behavior,
|
|
1807
|
+
// so if we try to use 'expect(() => {$parse('a.b=1')({a:false});).toThrow()' for testing
|
|
1808
|
+
// the test will fail in case of IE because it will not throw exception, and if we just use
|
|
1809
|
+
// '$parse('a.b=1')({a:false})' the test will fail because it will throw exception in case of Chrome
|
|
1810
|
+
// so we use tryParseAndIgnoreException helper to catch the exception silently for all cases.
|
|
1811
|
+
//
|
|
1812
|
+
function tryParseAndIgnoreException(expression) {
|
|
1813
|
+
try {
|
|
1814
|
+
$parse(expression)(scope);
|
|
1815
|
+
} catch (error) {
|
|
1816
|
+
/* ignore exception */
|
|
1819
1817
|
}
|
|
1820
|
-
}
|
|
1818
|
+
}
|
|
1819
|
+
});
|
|
1821
1820
|
});
|
|
1822
1821
|
});
|
|
1823
1822
|
|
|
@@ -60,13 +60,13 @@ describe("event directives", () => {
|
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
it("should expose event on form submit", () => {
|
|
63
|
-
|
|
63
|
+
app.innerHTML =
|
|
64
64
|
'<form ng-submit="formSubmission($event)">' +
|
|
65
65
|
'<input type="submit" />' +
|
|
66
|
-
"</form>"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
"</form>";
|
|
67
|
+
window.angular.bootstrap(app, ["myModule"]).invoke((_$rootScope_) => {
|
|
68
|
+
$rootScope = _$rootScope_;
|
|
69
|
+
});
|
|
70
70
|
element = app.querySelector("form");
|
|
71
71
|
$rootScope.formSubmission = function (e) {
|
|
72
72
|
if (e) {
|
|
@@ -352,7 +352,6 @@
|
|
|
352
352
|
_ `ngMessages` is a directive that is designed to show and hide messages based on the state
|
|
353
353
|
_ of a key/value object that it listens on. The directive itself complements error message
|
|
354
354
|
_ reporting with the `ngModel` $error object (which stores a key/value state of validation errors).
|
|
355
|
-
|
|
356
355
|
-
|
|
357
356
|
- `ngMessages` manages the state of internal messages within its container element. The internal
|
|
358
357
|
- messages use the `ngMessage` directive and will be inserted/removed from the page depending
|
|
@@ -440,7 +439,6 @@
|
|
|
440
439
|
_ determine what messages are overridden due to the placement of the ngMessagesInclude directive. \*
|
|
441
440
|
_ @usage
|
|
442
441
|
_ `html
|
|
443
|
-
|
|
444
442
|
- <!-- using attribute directives -->
|
|
445
443
|
- <ANY ng-messages="expression" role="alert">
|
|
446
444
|
- <ANY ng-messages-include="remoteTplString">...</ANY>
|
|
@@ -473,7 +471,6 @@ _ {@link module:ngMessages Click here} to learn more about`ngMessages`and`ngMess
|
|
|
473
471
|
_ {@link module:ngMessages `ngMessages` module documentation}. \*
|
|
474
472
|
_ @usage
|
|
475
473
|
_ `html
|
|
476
|
-
|
|
477
474
|
- <!-- using attribute directives -->
|
|
478
475
|
- <ANY ng-messages="expression" role="alert">
|
|
479
476
|
- <ANY ng-message="stringValue">...</ANY>
|
|
@@ -502,7 +499,6 @@ _ {@link module:ngMessages Click here} to learn more about`ngMessages`and`ngMess
|
|
|
502
499
|
_
|
|
503
500
|
_ @usage
|
|
504
501
|
_ `html
|
|
505
|
-
|
|
506
502
|
- <!-- using attribute directives -->
|
|
507
503
|
- <ANY ng-messages="expression">
|
|
508
504
|
- <ANY ng-message-exp="expressionValue">...</ANY>
|
|
@@ -85,7 +85,7 @@ export function ngRepeatDirective($animate) {
|
|
|
85
85
|
transclude: "element",
|
|
86
86
|
priority: 1000,
|
|
87
87
|
terminal: true,
|
|
88
|
-
compile: ($element, $attr) => {
|
|
88
|
+
compile: (_$element, $attr) => {
|
|
89
89
|
const expression = $attr["ngRepeat"];
|
|
90
90
|
const hasAnimate = !!$attr["animate"];
|
|
91
91
|
|
package/src/injection-tokens.js
CHANGED
|
@@ -44,11 +44,11 @@ export const $injectTokens = Object.freeze({
|
|
|
44
44
|
$interpolate: "$interpolate",
|
|
45
45
|
$location: "$location",
|
|
46
46
|
$log: "$log",
|
|
47
|
-
$
|
|
47
|
+
$viewScroll: "$viewScroll",
|
|
48
48
|
$parse: "$parse",
|
|
49
49
|
$rootScope: "$rootScope",
|
|
50
50
|
$rootElement: "$rootElement",
|
|
51
|
-
$
|
|
51
|
+
$router: "$router",
|
|
52
52
|
$sce: "$sce",
|
|
53
53
|
$sceDelegate: "$sceDelegate",
|
|
54
54
|
$state: "$state",
|
package/src/interface.ts
CHANGED
|
@@ -37,6 +37,7 @@ export type ExpandoStore = {
|
|
|
37
37
|
* ```
|
|
38
38
|
*/
|
|
39
39
|
export type AnnotatedFactory = [...string[], (...args: any[]) => any];
|
|
40
|
+
export type InjectableFactory = (...args: any[]) => any;
|
|
40
41
|
|
|
41
42
|
/**
|
|
42
43
|
* A factory that can be either a standalone function or a dependency-annotated array.
|
|
@@ -44,8 +45,6 @@ export type AnnotatedFactory = [...string[], (...args: any[]) => any];
|
|
|
44
45
|
* The array form is used to support minification-safe dependency injection.
|
|
45
46
|
* See {@link AnnotatedFactory}.
|
|
46
47
|
*/
|
|
47
|
-
export type InjectableFactory = (...args: any[]) => any;
|
|
48
|
-
|
|
49
48
|
export type Injectable = AnnotatedFactory | InjectableFactory;
|
|
50
49
|
|
|
51
50
|
/**
|
package/src/ng.js
CHANGED
|
@@ -105,7 +105,7 @@ import { AnimateJsDriverProvider } from "./animations/animate-js-driver.js";
|
|
|
105
105
|
import { ngAnimateSwapDirective } from "./animations/animate-swap.js";
|
|
106
106
|
import { $$AnimateChildrenDirective } from "./animations/animate-children-directive.js";
|
|
107
107
|
import { UrlConfigProvider } from "./router/url/url-config.js";
|
|
108
|
-
import {
|
|
108
|
+
import { Router } from "./router/router.js";
|
|
109
109
|
import { ViewService } from "./router/view/view.js";
|
|
110
110
|
import { TransitionProvider } from "./router/transition/transition-service.js";
|
|
111
111
|
import { StateProvider } from "./router/state/state-service.js";
|
|
@@ -259,7 +259,7 @@ export function registerNgModule(angular) {
|
|
|
259
259
|
$parse: ParseProvider,
|
|
260
260
|
$$rAFScheduler: RafSchedulerProvider,
|
|
261
261
|
$rootScope: RootScopeProvider,
|
|
262
|
-
$
|
|
262
|
+
$router: Router,
|
|
263
263
|
$sce: SceProvider,
|
|
264
264
|
$sceDelegate: SceDelegateProvider,
|
|
265
265
|
$templateCache: TemplateCacheProvider,
|
|
@@ -268,7 +268,7 @@ export function registerNgModule(angular) {
|
|
|
268
268
|
$view: ViewService,
|
|
269
269
|
$transitions: TransitionProvider,
|
|
270
270
|
$state: StateProvider,
|
|
271
|
-
$
|
|
271
|
+
$viewScroll: ViewScrollProvider,
|
|
272
272
|
$templateFactory: TemplateFactoryProvider,
|
|
273
273
|
$url: UrlService,
|
|
274
274
|
$stateRegistry: StateRegistryProvider,
|
|
@@ -278,9 +278,9 @@ export function registerNgModule(angular) {
|
|
|
278
278
|
],
|
|
279
279
|
)
|
|
280
280
|
.factory("$stateParams", [
|
|
281
|
-
$t.$
|
|
281
|
+
$t.$router,
|
|
282
282
|
/**
|
|
283
|
-
* @param {import('./router/
|
|
283
|
+
* @param {import('./router/router.js').Router} globals
|
|
284
284
|
* @returns {import('./router/params/state-params.js').StateParams }
|
|
285
285
|
*/
|
|
286
286
|
(globals) => globals.params,
|
package/src/ng.spec.js
CHANGED
|
@@ -9,7 +9,7 @@ describe("public", () => {
|
|
|
9
9
|
it("sets up the angular object and the module loader", () => {
|
|
10
10
|
expect(window.angular).toBeDefined();
|
|
11
11
|
expect(window.angular.module).toBeDefined();
|
|
12
|
-
expect(window.angular.$
|
|
12
|
+
expect(window.angular.$t).toBeDefined();
|
|
13
13
|
});
|
|
14
14
|
|
|
15
15
|
it("sets up the ng module", () => {
|
|
@@ -245,7 +245,7 @@ export function $StateRefDynamicDirective(
|
|
|
245
245
|
|
|
246
246
|
$StateRefActiveDirective.$inject = [
|
|
247
247
|
"$state",
|
|
248
|
-
"$
|
|
248
|
+
"$router",
|
|
249
249
|
"$interpolate",
|
|
250
250
|
"$stateRegistry",
|
|
251
251
|
"$transitions",
|
|
@@ -253,7 +253,7 @@ $StateRefActiveDirective.$inject = [
|
|
|
253
253
|
|
|
254
254
|
/**
|
|
255
255
|
* @param {*} $state
|
|
256
|
-
* @param {import('../
|
|
256
|
+
* @param {import('../router.js').Router} $router
|
|
257
257
|
* @param {*} $interpolate
|
|
258
258
|
* @param {*} $stateRegistry
|
|
259
259
|
* @param {*} $transitions
|
|
@@ -261,7 +261,7 @@ $StateRefActiveDirective.$inject = [
|
|
|
261
261
|
*/
|
|
262
262
|
export function $StateRefActiveDirective(
|
|
263
263
|
$state,
|
|
264
|
-
$
|
|
264
|
+
$router,
|
|
265
265
|
$interpolate,
|
|
266
266
|
$stateRegistry,
|
|
267
267
|
$transitions,
|
|
@@ -300,8 +300,8 @@ export function $StateRefActiveDirective(
|
|
|
300
300
|
trans.promise.then(update, () => {});
|
|
301
301
|
}
|
|
302
302
|
$scope.$on("$destroy", setupEventListeners());
|
|
303
|
-
if ($
|
|
304
|
-
updateAfterTransition($
|
|
303
|
+
if ($router.transition) {
|
|
304
|
+
updateAfterTransition($router.transition);
|
|
305
305
|
}
|
|
306
306
|
function setupEventListeners() {
|
|
307
307
|
const deregisterStatesChangedListener =
|
|
@@ -61,7 +61,7 @@ describe("ngStateRef", () => {
|
|
|
61
61
|
$rootScope = $injector.get("$rootScope");
|
|
62
62
|
$compile = $injector.get("$compile");
|
|
63
63
|
$state = $injector.get("$state");
|
|
64
|
-
$stateParams = $injector.get("$
|
|
64
|
+
$stateParams = $injector.get("$router").params;
|
|
65
65
|
$url = $injector.get("$url");
|
|
66
66
|
$url.listen();
|
|
67
67
|
});
|
|
@@ -705,7 +705,7 @@ describe("ngSrefActive", () => {
|
|
|
705
705
|
$rootScope = $injector.get("$rootScope");
|
|
706
706
|
$compile = $injector.get("$compile");
|
|
707
707
|
$state = $injector.get("$state");
|
|
708
|
-
$stateParams = $injector.get("$
|
|
708
|
+
$stateParams = $injector.get("$router").params;
|
|
709
709
|
});
|
|
710
710
|
|
|
711
711
|
it("should update class for sibling ngSref", async () => {
|
|
@@ -24,7 +24,7 @@ import { getLocals } from "../state/state-registry.js";
|
|
|
24
24
|
* The ng-view can be targeted in a View using the name ([[StateDeclaration.views]]).
|
|
25
25
|
*
|
|
26
26
|
* - `autoscroll`: an expression. When it evaluates to true, the `ng-view` will be scrolled into view when it is activated.
|
|
27
|
-
* Uses [[$
|
|
27
|
+
* Uses [[$viewScroll]] to do the scrolling.
|
|
28
28
|
*
|
|
29
29
|
* - `onload`: Expression to evaluate whenever the view updates.
|
|
30
30
|
*
|
|
@@ -143,16 +143,16 @@ import { getLocals } from "../state/state-registry.js";
|
|
|
143
143
|
export let ngView = [
|
|
144
144
|
"$view",
|
|
145
145
|
"$animate",
|
|
146
|
-
"$
|
|
146
|
+
"$viewScroll",
|
|
147
147
|
"$interpolate",
|
|
148
148
|
/**
|
|
149
149
|
* @param {*} $view
|
|
150
150
|
* @param {*} $animate
|
|
151
|
-
* @param {*} $
|
|
151
|
+
* @param {*} $viewScroll
|
|
152
152
|
* @param {*} $interpolate
|
|
153
153
|
* @returns {import("../../interface.js").Directive}
|
|
154
154
|
*/
|
|
155
|
-
function $ViewDirective($view, $animate, $
|
|
155
|
+
function $ViewDirective($view, $animate, $viewScroll, $interpolate) {
|
|
156
156
|
function getRenderer() {
|
|
157
157
|
return {
|
|
158
158
|
enter: function (element, target, cb) {
|
|
@@ -289,7 +289,7 @@ export let ngView = [
|
|
|
289
289
|
(isDefined(autoScrollExp) && !autoScrollExp) ||
|
|
290
290
|
scope.$eval(autoScrollExp)
|
|
291
291
|
) {
|
|
292
|
-
$
|
|
292
|
+
$viewScroll(clone);
|
|
293
293
|
}
|
|
294
294
|
});
|
|
295
295
|
cleanupLastView();
|
|
@@ -12,7 +12,7 @@ describe("ngView", () => {
|
|
|
12
12
|
app,
|
|
13
13
|
$injector,
|
|
14
14
|
$state,
|
|
15
|
-
$
|
|
15
|
+
$viewScroll;
|
|
16
16
|
|
|
17
17
|
const aState = {
|
|
18
18
|
name: "a",
|
|
@@ -129,8 +129,8 @@ describe("ngView", () => {
|
|
|
129
129
|
app = window.angular
|
|
130
130
|
.module("defaultModule", [])
|
|
131
131
|
.config(($provide, _$stateProvider_) => {
|
|
132
|
-
$provide.decorator("$
|
|
133
|
-
return jasmine.createSpy("$
|
|
132
|
+
$provide.decorator("$viewScroll", () => {
|
|
133
|
+
return jasmine.createSpy("$viewScroll");
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
_$stateProvider_
|
|
@@ -156,11 +156,11 @@ describe("ngView", () => {
|
|
|
156
156
|
"defaultModule",
|
|
157
157
|
]);
|
|
158
158
|
|
|
159
|
-
$injector.invoke((_$state_, $rootScope, _$compile_, _$
|
|
159
|
+
$injector.invoke((_$state_, $rootScope, _$compile_, _$viewScroll_) => {
|
|
160
160
|
scope = $rootScope.$new();
|
|
161
161
|
$compile = _$compile_;
|
|
162
162
|
$state = _$state_;
|
|
163
|
-
$
|
|
163
|
+
$viewScroll = _$viewScroll_;
|
|
164
164
|
});
|
|
165
165
|
});
|
|
166
166
|
|
|
@@ -312,7 +312,7 @@ describe("ngView", () => {
|
|
|
312
312
|
|
|
313
313
|
$state.transitionTo(aState);
|
|
314
314
|
await wait(100);
|
|
315
|
-
expect($
|
|
315
|
+
expect($viewScroll).not.toHaveBeenCalled();
|
|
316
316
|
});
|
|
317
317
|
|
|
318
318
|
it("should autoscroll when expression is missing", async () => {
|
|
@@ -324,7 +324,7 @@ describe("ngView", () => {
|
|
|
324
324
|
|
|
325
325
|
// animateFlush($animate);
|
|
326
326
|
|
|
327
|
-
expect($
|
|
327
|
+
expect($viewScroll).toHaveBeenCalledWith(elem.querySelector("ng-view"));
|
|
328
328
|
});
|
|
329
329
|
|
|
330
330
|
it("should autoscroll based on expression", async () => {
|
|
@@ -336,12 +336,12 @@ describe("ngView", () => {
|
|
|
336
336
|
$state.transitionTo(aState);
|
|
337
337
|
await wait(100);
|
|
338
338
|
|
|
339
|
-
expect($
|
|
339
|
+
expect($viewScroll).not.toHaveBeenCalled();
|
|
340
340
|
|
|
341
341
|
scope.doScroll = true;
|
|
342
342
|
$state.transitionTo(bState);
|
|
343
343
|
await wait(100);
|
|
344
|
-
expect($
|
|
344
|
+
expect($viewScroll).toHaveBeenCalledWith(elem.querySelector("ng-view"));
|
|
345
345
|
});
|
|
346
346
|
});
|
|
347
347
|
|
|
@@ -809,7 +809,7 @@ describe("ngView named", () => {
|
|
|
809
809
|
$injector,
|
|
810
810
|
$state,
|
|
811
811
|
$rootScope,
|
|
812
|
-
$
|
|
812
|
+
$viewScroll;
|
|
813
813
|
|
|
814
814
|
beforeEach(() => {
|
|
815
815
|
window.angular = new Angular();
|
|
@@ -831,12 +831,12 @@ describe("ngView named", () => {
|
|
|
831
831
|
"defaultModule",
|
|
832
832
|
]);
|
|
833
833
|
|
|
834
|
-
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$
|
|
834
|
+
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$viewScroll_) => {
|
|
835
835
|
$rootScope = _$rootScope_;
|
|
836
836
|
scope = $rootScope.$new();
|
|
837
837
|
$compile = _$compile_;
|
|
838
838
|
$state = _$state_;
|
|
839
|
-
$
|
|
839
|
+
$viewScroll = _$viewScroll_;
|
|
840
840
|
});
|
|
841
841
|
});
|
|
842
842
|
|
|
@@ -903,7 +903,7 @@ describe("ngView transclusion", () => {
|
|
|
903
903
|
"defaultModule",
|
|
904
904
|
]);
|
|
905
905
|
|
|
906
|
-
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$
|
|
906
|
+
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$viewScroll_) => {
|
|
907
907
|
$rootScope = _$rootScope_;
|
|
908
908
|
scope = $rootScope.$new();
|
|
909
909
|
$compile = _$compile_;
|
|
@@ -973,7 +973,7 @@ describe("ngView controllers or onEnter handlers", () => {
|
|
|
973
973
|
"defaultModule",
|
|
974
974
|
]);
|
|
975
975
|
|
|
976
|
-
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$
|
|
976
|
+
$injector.invoke((_$state_, _$rootScope_, _$compile_, _$viewScroll_) => {
|
|
977
977
|
$rootScope = _$rootScope_;
|
|
978
978
|
scope = $rootScope.$new();
|
|
979
979
|
$compile = _$compile_;
|
|
@@ -1832,9 +1832,9 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1832
1832
|
name: "ng12-dynamic-directive",
|
|
1833
1833
|
url: "/ng12dynamicDirective/:type",
|
|
1834
1834
|
componentProvider: [
|
|
1835
|
-
"$
|
|
1836
|
-
function ($
|
|
1837
|
-
return $
|
|
1835
|
+
"$router",
|
|
1836
|
+
function ($router) {
|
|
1837
|
+
return $router.params.type;
|
|
1838
1838
|
},
|
|
1839
1839
|
],
|
|
1840
1840
|
});
|
|
@@ -1860,9 +1860,9 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1860
1860
|
name: "dynamicComponent",
|
|
1861
1861
|
url: "/dynamicComponent/:type",
|
|
1862
1862
|
componentProvider: [
|
|
1863
|
-
"$
|
|
1864
|
-
function ($
|
|
1865
|
-
return $
|
|
1863
|
+
"$router",
|
|
1864
|
+
function ($router) {
|
|
1865
|
+
return $router.params.type;
|
|
1866
1866
|
},
|
|
1867
1867
|
],
|
|
1868
1868
|
});
|
|
@@ -27,7 +27,6 @@ export class ParamType {
|
|
|
27
27
|
/**
|
|
28
28
|
* @param def A configuration object which contains the custom type definition. The object's
|
|
29
29
|
* properties will override the default methods and/or pattern in `ParamType`'s public interface.
|
|
30
|
-
* @returns a new ParamType object
|
|
31
30
|
*/
|
|
32
31
|
constructor(def) {
|
|
33
32
|
this.pattern = /.*/;
|
|
@@ -192,7 +192,7 @@ export class Param {
|
|
|
192
192
|
const normalized = this.type.$normalize(value);
|
|
193
193
|
if (!this.type.is(normalized)) return false;
|
|
194
194
|
// The value was of the correct type, but when encoded, did not match the ParamType's regexp
|
|
195
|
-
const encoded = this.type.encode(normalized);
|
|
195
|
+
const encoded = normalized; // this.type.encode(normalized);
|
|
196
196
|
return !(isString(encoded) && !this.type.pattern.exec(encoded));
|
|
197
197
|
}
|
|
198
198
|
toString() {
|
|
@@ -9,7 +9,7 @@ import { Queue } from "../shared/queue.js";
|
|
|
9
9
|
* This is where we hold the global mutable state such as current state, current
|
|
10
10
|
* params, current transition, etc.
|
|
11
11
|
*/
|
|
12
|
-
export class
|
|
12
|
+
export class Router {
|
|
13
13
|
constructor() {
|
|
14
14
|
/**
|
|
15
15
|
* Current parameter values
|