@angular-wave/angular.ts 0.0.28 → 0.0.30
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 +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/index.html +2 -2
- package/package.json +1 -1
- package/src/core/controller.js +3 -0
- package/src/directive/controller.js +0 -56
- package/src/directive/controller.md +46 -0
- package/src/router/common/trace.js +7 -7
- package/src/router/directives/state-directives.js +75 -75
- package/src/router/directives/view-directive.js +21 -21
- package/src/router/hooks/update-globals.js +1 -1
- package/src/router/index.js +12 -12
- package/src/router/injectables.js +11 -11
- package/src/router/resolve/resolve-context.js +1 -1
- package/src/router/router.js +8 -77
- package/src/router/services.js +5 -43
- package/src/router/state/state-builder.js +1 -0
- package/src/router/state/state-object.js +1 -1
- package/src/router/state/state-registry.js +56 -3
- package/src/router/state/state-service.js +16 -25
- package/src/router/state/target-state.js +1 -1
- package/src/router/state/views.js +5 -5
- package/src/router/state-filters.js +0 -2
- package/src/router/state-provider.js +0 -2
- package/src/router/template-factory.js +4 -4
- package/src/router/transition/transition-service.js +2 -3
- package/src/router/url/url-config.js +0 -2
- package/src/router/url/url-matcher-factory.js +0 -1
- package/src/router/url/url-matcher.js +0 -8
- package/src/router/url/url-router.js +4 -0
- package/src/router/url/url-service.js +6 -6
- package/src/router/view/view.js +67 -65
- package/src/services/browser.js +1 -5
- package/src/shared/common.js +1 -1
- package/test/core/pubsub.spec.js +73 -0
- package/test/module-test.html +5 -5
- package/test/original-test.html +3 -3
- package/test/router/services.spec.js +1 -1
- package/test/router/state-directives.spec.js +72 -80
- package/test/router/state-filter.spec.js +6 -4
- package/test/router/state.spec.js +15 -13
- package/test/router/template-factory.spec.js +4 -4
- package/test/router/url-matcher-factory.spec.js +2 -2
- package/test/router/view-directive.spec.js +165 -163
- package/test/router/view-hook.spec.js +2 -2
- package/test/router/view-scroll.spec.js +14 -14
- package/test/router/view.spec.js +2 -2
- package/types/router/core/common/coreservices.d.ts +2 -2
- package/types/router/core/common/trace.d.ts +7 -7
- package/types/router/core/globals.d.ts +2 -1
- package/types/router/core/interface.d.ts +3 -10
- package/types/router/core/params/interface.d.ts +3 -3
- package/types/router/core/resolve/resolveContext.d.ts +4 -4
- package/types/router/core/router.d.ts +5 -51
- package/types/router/core/state/interface.d.ts +12 -12
- package/types/router/core/state/stateObject.d.ts +1 -1
- package/types/router/core/state/stateQueueManager.d.ts +2 -2
- package/types/router/core/state/stateRegistry.d.ts +5 -4
- package/types/router/core/state/stateService.d.ts +13 -13
- package/types/router/core/state/targetState.d.ts +1 -1
- package/types/router/core/transition/interface.d.ts +2 -2
- package/types/router/core/transition/transition.d.ts +12 -12
- package/types/router/core/transition/transitionService.d.ts +5 -5
- package/types/router/core/url/interface.d.ts +3 -3
- package/types/router/core/url/urlConfig.d.ts +3 -3
- package/types/router/core/url/urlMatcherFactory.d.ts +3 -3
- package/types/router/core/url/urlRouter.d.ts +2 -2
- package/types/router/core/url/urlRule.d.ts +6 -6
- package/types/router/core/url/urlRules.d.ts +6 -6
- package/types/router/core/url/urlService.d.ts +8 -8
- package/types/router/core/view/interface.d.ts +3 -3
- package/types/router/core/view/view.d.ts +26 -26
- package/types/router/directives/viewDirective.d.ts +6 -6
- package/types/router/interface.d.ts +8 -8
- package/types/router/locationServices.d.ts +3 -3
- package/types/router/services.d.ts +1 -1
- package/types/router/stateProvider.d.ts +5 -5
- package/types/router/statebuilders/views.d.ts +1 -1
- package/types/router/templateFactory.d.ts +2 -2
- package/types/router/viewScroll.d.ts +2 -2
|
@@ -25,7 +25,7 @@ describe("view hooks", () => {
|
|
|
25
25
|
window.angular = new Angular();
|
|
26
26
|
publishExternalAPI();
|
|
27
27
|
app = window.angular
|
|
28
|
-
.module("defaultModule", ["
|
|
28
|
+
.module("defaultModule", ["ng.router"])
|
|
29
29
|
.config(($stateProvider) => {
|
|
30
30
|
$stateProvider.state({ name: "foo", url: "/foo", component: "foo" });
|
|
31
31
|
$stateProvider.state({ name: "bar", url: "/bar", component: "bar" });
|
|
@@ -47,7 +47,7 @@ describe("view hooks", () => {
|
|
|
47
47
|
$state = _$state_;
|
|
48
48
|
$q = _$q_;
|
|
49
49
|
$timeout = _$timeout_;
|
|
50
|
-
$compile("<div><
|
|
50
|
+
$compile("<div><ng-view></ng-view></div>")($rootScope.$new());
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
|
|
@@ -3,30 +3,30 @@ import { Angular } from "../../src/loader";
|
|
|
3
3
|
import { publishExternalAPI } from "../../src/public";
|
|
4
4
|
import { wait } from "../test-utils";
|
|
5
5
|
|
|
6
|
-
describe("
|
|
6
|
+
describe("ngView", () => {
|
|
7
7
|
describe("scrollIntoView", () => {
|
|
8
|
-
let elem, $anchorScroll, $
|
|
8
|
+
let elem, $anchorScroll, $ngViewScroll, $timeout;
|
|
9
9
|
|
|
10
10
|
beforeEach(() => {
|
|
11
11
|
dealoc(document.getElementById("dummy"));
|
|
12
12
|
window.angular = new Angular();
|
|
13
13
|
publishExternalAPI();
|
|
14
|
-
window.angular.module("defaultModule", ["
|
|
14
|
+
window.angular.module("defaultModule", ["ng.router"]);
|
|
15
15
|
let $injector = window.angular.bootstrap(
|
|
16
16
|
document.getElementById("dummy"),
|
|
17
17
|
["defaultModule"],
|
|
18
18
|
);
|
|
19
19
|
|
|
20
|
-
$injector.invoke((_$
|
|
20
|
+
$injector.invoke((_$ngViewScroll_, _$timeout_, _$anchorScroll_) => {
|
|
21
21
|
$anchorScroll = _$anchorScroll_;
|
|
22
|
-
$
|
|
22
|
+
$ngViewScroll = _$ngViewScroll_;
|
|
23
23
|
$timeout = _$timeout_;
|
|
24
24
|
});
|
|
25
25
|
elem = [{ scrollIntoView: jasmine.createSpy("scrollIntoView") }];
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
it("should scroll element into view after timeout", async () => {
|
|
29
|
-
$
|
|
29
|
+
$ngViewScroll(elem);
|
|
30
30
|
expect(elem[0].scrollIntoView).not.toHaveBeenCalled();
|
|
31
31
|
|
|
32
32
|
await wait(100);
|
|
@@ -34,7 +34,7 @@ describe("uiView", () => {
|
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
it("should return the promise from the timeout", async () => {
|
|
37
|
-
const promise = $
|
|
37
|
+
const promise = $ngViewScroll(elem);
|
|
38
38
|
|
|
39
39
|
await wait(100);
|
|
40
40
|
expect(elem[0].scrollIntoView).toHaveBeenCalled();
|
|
@@ -43,18 +43,18 @@ describe("uiView", () => {
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
describe("useAnchorScroll", () => {
|
|
46
|
-
let elem, $anchorScroll, $
|
|
46
|
+
let elem, $anchorScroll, $ngViewScroll;
|
|
47
47
|
|
|
48
48
|
beforeEach(() => {
|
|
49
49
|
dealoc(document.getElementById("dummy"));
|
|
50
50
|
window.angular = new Angular();
|
|
51
51
|
publishExternalAPI();
|
|
52
|
-
let module = window.angular.module("defaultModule", ["
|
|
53
|
-
module.config(($provide, $
|
|
52
|
+
let module = window.angular.module("defaultModule", ["ng.router"]);
|
|
53
|
+
module.config(($provide, $ngViewScrollProvider) => {
|
|
54
54
|
$provide.decorator("$anchorScroll", function ($delegate) {
|
|
55
55
|
return jasmine.createSpy("$anchorScroll");
|
|
56
56
|
});
|
|
57
|
-
$
|
|
57
|
+
$ngViewScrollProvider.useAnchorScroll();
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
let $injector = window.angular.bootstrap(
|
|
@@ -62,15 +62,15 @@ describe("uiView", () => {
|
|
|
62
62
|
["defaultModule"],
|
|
63
63
|
);
|
|
64
64
|
|
|
65
|
-
$injector.invoke((_$
|
|
65
|
+
$injector.invoke((_$ngViewScroll_, _$anchorScroll_) => {
|
|
66
66
|
$anchorScroll = _$anchorScroll_;
|
|
67
|
-
$
|
|
67
|
+
$ngViewScroll = _$ngViewScroll_;
|
|
68
68
|
});
|
|
69
69
|
elem = [{ scrollIntoView: jasmine.createSpy("scrollIntoView") }];
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
it("should call $anchorScroll", () => {
|
|
73
|
-
$
|
|
73
|
+
$ngViewScroll();
|
|
74
74
|
expect($anchorScroll).toHaveBeenCalled();
|
|
75
75
|
});
|
|
76
76
|
});
|
package/test/router/view.spec.js
CHANGED
|
@@ -32,7 +32,7 @@ describe("view", () => {
|
|
|
32
32
|
publishExternalAPI();
|
|
33
33
|
|
|
34
34
|
window.angular
|
|
35
|
-
.module("defaultModule", ["
|
|
35
|
+
.module("defaultModule", ["ng.router"])
|
|
36
36
|
.config(
|
|
37
37
|
function (
|
|
38
38
|
_$provide_,
|
|
@@ -106,7 +106,7 @@ describe("view", () => {
|
|
|
106
106
|
|
|
107
107
|
it("uses the controllerProvider to get controller dynamically", async () => {
|
|
108
108
|
$controllerProvider.register("AcmeFooController", () => {});
|
|
109
|
-
elem.append($compile("<div><
|
|
109
|
+
elem.append($compile("<div><ng-view></ng-view></div>")(scope));
|
|
110
110
|
|
|
111
111
|
const view = tail(path).views[0];
|
|
112
112
|
view.load();
|
|
@@ -39,7 +39,7 @@ export interface CoreServices {
|
|
|
39
39
|
* Implementors should pass these through to the underlying URL mechanism.
|
|
40
40
|
* The underlying URL mechanism might be browser APIs, framework APIs, or some 3rd party URL management library.
|
|
41
41
|
*
|
|
42
|
-
*
|
|
42
|
+
* Router Core includes three basic implementations:
|
|
43
43
|
*
|
|
44
44
|
* - [[PushStateLocationService]]
|
|
45
45
|
* - [[HashLocationService]]
|
|
@@ -61,7 +61,7 @@ export interface LocationServices {
|
|
|
61
61
|
* Implementors should pass these through to the underlying URL APIs.
|
|
62
62
|
* The underlying URL mechanism might be browser APIs, framework APIs, or some 3rd party URL management library.
|
|
63
63
|
*
|
|
64
|
-
*
|
|
64
|
+
* Router Core includes two basic implementations:
|
|
65
65
|
*
|
|
66
66
|
* - [[BrowserLocationConfig]]
|
|
67
67
|
* - [[MemoryLocationConfig]]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Transition } from "../transition/transition";
|
|
2
2
|
import { ViewTuple } from "../view";
|
|
3
|
-
import {
|
|
3
|
+
import { ActiveNGView, ViewConfig, ViewContext } from "../view/interface";
|
|
4
4
|
import { Resolvable } from "../resolve/resolvable";
|
|
5
5
|
import { PathNode } from "../path/pathNode";
|
|
6
6
|
import { PolicyWhen } from "../resolve/interface";
|
|
@@ -24,12 +24,12 @@ declare enum Category {
|
|
|
24
24
|
RESOLVE = 0,
|
|
25
25
|
TRANSITION = 1,
|
|
26
26
|
HOOK = 2,
|
|
27
|
-
|
|
27
|
+
NGVIEW = 3,
|
|
28
28
|
VIEWCONFIG = 4,
|
|
29
29
|
}
|
|
30
30
|
export { Category };
|
|
31
31
|
/**
|
|
32
|
-
* Prints
|
|
32
|
+
* Prints Router Transition trace information to the console.
|
|
33
33
|
*/
|
|
34
34
|
export declare class Trace {
|
|
35
35
|
/** @internal */
|
|
@@ -101,17 +101,17 @@ export declare class Trace {
|
|
|
101
101
|
/** @internal called by ui-router code */
|
|
102
102
|
traceSuccess(finalState: StateObject, trans: Transition): void;
|
|
103
103
|
/** @internal called by ui-router code */
|
|
104
|
-
|
|
104
|
+
traceNGViewEvent(event: string, viewData: ActiveNGView, extra?: string): void;
|
|
105
105
|
/** @internal called by ui-router code */
|
|
106
|
-
|
|
106
|
+
traceNGViewConfigUpdated(viewData: ActiveNGView, context: ViewContext): void;
|
|
107
107
|
/** @internal called by ui-router code */
|
|
108
|
-
|
|
108
|
+
traceNGViewFill(viewData: ActiveNGView, html: string): void;
|
|
109
109
|
/** @internal called by ui-router code */
|
|
110
110
|
traceViewSync(pairs: ViewTuple[]): void;
|
|
111
111
|
/** @internal called by ui-router code */
|
|
112
112
|
traceViewServiceEvent(event: string, viewConfig: ViewConfig): void;
|
|
113
113
|
/** @internal called by ui-router code */
|
|
114
|
-
|
|
114
|
+
traceViewServiceNGViewEvent(event: string, viewData: ActiveNGView): void;
|
|
115
115
|
}
|
|
116
116
|
/**
|
|
117
117
|
* The [[Trace]] singleton
|
|
@@ -3,12 +3,13 @@ import { StateDeclaration } from "./state/interface";
|
|
|
3
3
|
import { StateObject } from "./state/stateObject";
|
|
4
4
|
import { Transition } from "./transition/transition";
|
|
5
5
|
import { Queue } from "./common/queue";
|
|
6
|
+
/**
|
|
6
7
|
* Global router state
|
|
7
8
|
*
|
|
8
9
|
* This is where we hold the global mutable state such as current state, current
|
|
9
10
|
* params, current transition, etc.
|
|
10
11
|
*/
|
|
11
|
-
export declare class
|
|
12
|
+
export declare class RouterGlobals {
|
|
12
13
|
/**
|
|
13
14
|
* Current parameter values
|
|
14
15
|
*
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Router } from "./router";
|
|
2
2
|
/**
|
|
3
3
|
* An interface for getting values from dependency injection.
|
|
4
4
|
*
|
|
5
5
|
* This is primarily used to get resolve values for a given token.
|
|
6
|
-
* An instance of the `
|
|
6
|
+
* An instance of the `NGInjector` can be retrieved from the current transition using [[Transition.injector]].
|
|
7
7
|
*
|
|
8
8
|
* ---
|
|
9
9
|
*
|
|
@@ -13,7 +13,7 @@ import { UIRouter } from "./router";
|
|
|
13
13
|
* In Angular 2, the native injector might be the root Injector,
|
|
14
14
|
* or it might be a lazy loaded `NgModule` injector scoped to a lazy load state tree.
|
|
15
15
|
*/
|
|
16
|
-
export interface
|
|
16
|
+
export interface NGInjector {
|
|
17
17
|
/**
|
|
18
18
|
* Gets a value from the injector.
|
|
19
19
|
*
|
|
@@ -89,10 +89,3 @@ export interface UIInjector {
|
|
|
89
89
|
getNative(token: any): any;
|
|
90
90
|
getNative<T>(token: any): T;
|
|
91
91
|
}
|
|
92
|
-
export interface UIRouterPlugin {
|
|
93
|
-
name: string;
|
|
94
|
-
}
|
|
95
|
-
export declare abstract class UIRouterPluginBase implements UIRouterPlugin {
|
|
96
|
-
abstract name: string;
|
|
97
|
-
dispose(router: UIRouter): void;
|
|
98
|
-
}
|
|
@@ -53,7 +53,7 @@ export interface ParamDeclaration {
|
|
|
53
53
|
* Specifies the default value for this parameter.
|
|
54
54
|
* This implicitly sets this parameter as optional.
|
|
55
55
|
*
|
|
56
|
-
* When
|
|
56
|
+
* When Router routes to a state and no value is specified for this parameter in the URL or transition,
|
|
57
57
|
* the default value will be used instead.
|
|
58
58
|
* If value is a function, it will be injected and invoked, and the return value used.
|
|
59
59
|
*
|
|
@@ -245,7 +245,7 @@ export interface ParamDeclaration {
|
|
|
245
245
|
* Normally, if a parameter value changes, the state which declared that the parameter will be reloaded (entered/exited).
|
|
246
246
|
* When a parameter is `dynamic`, a transition still occurs, but it does not cause the state to exit/enter.
|
|
247
247
|
*
|
|
248
|
-
* This can be useful to build
|
|
248
|
+
* This can be useful to build NG where the component updates itself when the param values change.
|
|
249
249
|
* A common scenario where this is useful is searching/paging/sorting.
|
|
250
250
|
*
|
|
251
251
|
* ---
|
|
@@ -373,7 +373,7 @@ export interface Replace {
|
|
|
373
373
|
* - some internal string representation
|
|
374
374
|
*
|
|
375
375
|
* Typed parameter definitions control how parameter values are encoded (to the URL) and decoded (from the URL).
|
|
376
|
-
*
|
|
376
|
+
* Router always provides the decoded parameter values to the user (from methods such as [[Transition.params]])).
|
|
377
377
|
*
|
|
378
378
|
* For example, if a state has a url of `/foo/{fooId:int}` (the `fooId` parameter is of the `int` ParamType)
|
|
379
379
|
* and if the browser is at `/foo/123`, then the 123 is parsed as an integer:
|
|
@@ -3,12 +3,12 @@ import { PathNode } from "../path/pathNode";
|
|
|
3
3
|
import { Resolvable } from "./resolvable";
|
|
4
4
|
import { StateObject } from "../state/stateObject";
|
|
5
5
|
import { Transition } from "../transition/transition";
|
|
6
|
-
import {
|
|
6
|
+
import { NGInjector } from "../interface";
|
|
7
7
|
export declare const NATIVE_INJECTOR_TOKEN: string;
|
|
8
8
|
/**
|
|
9
9
|
* Encapsulates Dependency Injection for a path of nodes
|
|
10
10
|
*
|
|
11
|
-
*
|
|
11
|
+
* Router states are organized as a tree.
|
|
12
12
|
* A nested state has a path of ancestors to the root of the tree.
|
|
13
13
|
* When a state is being activated, each element in the path is wrapped as a [[PathNode]].
|
|
14
14
|
* A `PathNode` is a stateful object that holds things like parameters and resolvables for the state being activated.
|
|
@@ -17,7 +17,7 @@ export declare const NATIVE_INJECTOR_TOKEN: string;
|
|
|
17
17
|
*/
|
|
18
18
|
export declare class ResolveContext {
|
|
19
19
|
private _path;
|
|
20
|
-
_injector:
|
|
20
|
+
_injector: NGInjector;
|
|
21
21
|
constructor(_path: PathNode[]);
|
|
22
22
|
/** Gets all the tokens found in the resolve context, de-duplicated */
|
|
23
23
|
getTokens(): any[];
|
|
@@ -86,7 +86,7 @@ export declare class ResolveContext {
|
|
|
86
86
|
value: any;
|
|
87
87
|
}[]
|
|
88
88
|
>;
|
|
89
|
-
injector():
|
|
89
|
+
injector(): NGInjector;
|
|
90
90
|
findNode(resolvable: Resolvable): PathNode;
|
|
91
91
|
/**
|
|
92
92
|
* Gets the async dependencies of a Resolvable
|
|
@@ -4,17 +4,16 @@ import { TransitionService } from "./transition/transitionService";
|
|
|
4
4
|
import { ViewService } from "./view/view";
|
|
5
5
|
import { StateRegistry } from "./state/stateRegistry";
|
|
6
6
|
import { StateService } from "./state/stateService";
|
|
7
|
-
import {
|
|
8
|
-
import { UIRouterPlugin } from "./interface";
|
|
7
|
+
import { RouterGlobals } from "./globals";
|
|
9
8
|
import { UrlService } from "./url/urlService";
|
|
10
9
|
import { LocationServices, LocationConfig } from "./common/coreservices";
|
|
11
10
|
import { Trace } from "./common/trace";
|
|
12
11
|
/**
|
|
13
|
-
* An instance of
|
|
12
|
+
* An instance of Router.
|
|
14
13
|
*
|
|
15
14
|
* This object contains references to service APIs which define your application's routing behavior.
|
|
16
15
|
*/
|
|
17
|
-
export declare class
|
|
16
|
+
export declare class Router {
|
|
18
17
|
locationService: LocationServices;
|
|
19
18
|
locationConfig: LocationConfig;
|
|
20
19
|
/** @internal */ $id: number;
|
|
@@ -25,7 +24,7 @@ export declare class UIRouter {
|
|
|
25
24
|
/** Provides services related to ui-view synchronization */
|
|
26
25
|
viewService: ViewService;
|
|
27
26
|
/** An object that contains global router state, such as the current state and params */
|
|
28
|
-
globals:
|
|
27
|
+
globals: RouterGlobals;
|
|
29
28
|
/** A service that exposes global Transition Hooks */
|
|
30
29
|
transitionService: TransitionService;
|
|
31
30
|
/**
|
|
@@ -44,23 +43,8 @@ export declare class UIRouter {
|
|
|
44
43
|
stateRegistry: StateRegistry;
|
|
45
44
|
/** Provides services related to states */
|
|
46
45
|
stateService: StateService;
|
|
47
|
-
/** @internal plugin instances are registered here */
|
|
48
|
-
private _plugins;
|
|
49
|
-
|
|
50
46
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* When called, clears resources retained by the router by calling `dispose(this)` on all
|
|
54
|
-
* registered [[disposable]] objects.
|
|
55
|
-
*
|
|
56
|
-
* Or, if a `disposable` object is provided, calls `dispose(this)` on that object only.
|
|
57
|
-
*
|
|
58
|
-
* @internal
|
|
59
|
-
* @param disposable (optional) the disposable to dispose
|
|
60
|
-
*/
|
|
61
|
-
dispose(disposable?: any): void;
|
|
62
|
-
/**
|
|
63
|
-
* Creates a new `UIRouter` object
|
|
47
|
+
* Creates a new `Router` object
|
|
64
48
|
*
|
|
65
49
|
* @param locationService a [[LocationServices]] implementation
|
|
66
50
|
* @param locationConfig a [[LocationConfig]] implementation
|
|
@@ -70,34 +54,4 @@ export declare class UIRouter {
|
|
|
70
54
|
locationService?: LocationServices,
|
|
71
55
|
locationConfig?: LocationConfig,
|
|
72
56
|
);
|
|
73
|
-
/** Add plugin (as ES6 class) */
|
|
74
|
-
plugin<T extends UIRouterPlugin>(
|
|
75
|
-
plugin: {
|
|
76
|
-
new (router: UIRouter, options?: any): T;
|
|
77
|
-
},
|
|
78
|
-
options?: any,
|
|
79
|
-
): T;
|
|
80
|
-
/** Add plugin (as javascript constructor function) */
|
|
81
|
-
plugin<T extends UIRouterPlugin>(
|
|
82
|
-
plugin: {
|
|
83
|
-
(router: UIRouter, options?: any): void;
|
|
84
|
-
},
|
|
85
|
-
options?: any,
|
|
86
|
-
): T;
|
|
87
|
-
/** Add plugin (as javascript factory function) */
|
|
88
|
-
plugin<T extends UIRouterPlugin>(plugin: PluginFactory<T>, options?: any): T;
|
|
89
|
-
/**
|
|
90
|
-
* Returns a plugin registered with the given `pluginName`.
|
|
91
|
-
*
|
|
92
|
-
* @param pluginName the name of the plugin to get
|
|
93
|
-
* @return the plugin, or undefined
|
|
94
|
-
*/
|
|
95
|
-
getPlugin(pluginName: string): UIRouterPlugin;
|
|
96
|
-
/**
|
|
97
|
-
* Returns all registered plugins
|
|
98
|
-
* @return all registered plugins
|
|
99
|
-
*/
|
|
100
|
-
getPlugin(): UIRouterPlugin[];
|
|
101
57
|
}
|
|
102
|
-
/** @internal */
|
|
103
|
-
export declare type PluginFactory<T> = (router: UIRouter, options?: any) => T;
|
|
@@ -31,7 +31,7 @@ export declare type ResolveTypes =
|
|
|
31
31
|
* Base interface for declaring a view
|
|
32
32
|
*
|
|
33
33
|
* This interface defines the basic data that a normalized view declaration will have on it.
|
|
34
|
-
* Each implementation of
|
|
34
|
+
* Each implementation of Router (for a specific framework) should define its own extension of this interface.
|
|
35
35
|
* Add any additional fields that the framework requires to that interface.
|
|
36
36
|
*/
|
|
37
37
|
export interface _ViewDeclaration {
|
|
@@ -42,20 +42,20 @@ export interface _ViewDeclaration {
|
|
|
42
42
|
/**
|
|
43
43
|
* The normalized address for the `ui-view` which this ViewConfig targets.
|
|
44
44
|
*
|
|
45
|
-
* A ViewConfig targets a `ui-view` in the DOM (relative to the `
|
|
45
|
+
* A ViewConfig targets a `ui-view` in the DOM (relative to the `ngViewContextAnchor`) which has
|
|
46
46
|
* a specific name.
|
|
47
47
|
* @example `header` or `$default`
|
|
48
48
|
*
|
|
49
|
-
* The `
|
|
49
|
+
* The `ngViewName` can also target a _nested view_ by providing a dot-notation address
|
|
50
50
|
* @example `foo.bar` or `foo.$default.bar`
|
|
51
51
|
*/
|
|
52
|
-
$
|
|
52
|
+
$ngViewName?: string;
|
|
53
53
|
/**
|
|
54
|
-
* The normalized context anchor (state name) for the `
|
|
54
|
+
* The normalized context anchor (state name) for the `ngViewName`
|
|
55
55
|
*
|
|
56
|
-
* When targeting a `ui-view`, the `
|
|
56
|
+
* When targeting a `ui-view`, the `ngViewName` address is anchored to a context name (state name).
|
|
57
57
|
*/
|
|
58
|
-
$
|
|
58
|
+
$ngViewContextAnchor?: string;
|
|
59
59
|
/**
|
|
60
60
|
* A type identifier for the View
|
|
61
61
|
*
|
|
@@ -86,7 +86,7 @@ export declare type RedirectToResult =
|
|
|
86
86
|
/**
|
|
87
87
|
* The StateDeclaration object is used to define a state or nested state.
|
|
88
88
|
*
|
|
89
|
-
* Note: Each implementation of
|
|
89
|
+
* Note: Each implementation of Router (for a specific framework)
|
|
90
90
|
* extends this interface as necessary.
|
|
91
91
|
*
|
|
92
92
|
* #### Example:
|
|
@@ -203,7 +203,7 @@ export interface StateDeclaration {
|
|
|
203
203
|
* - Each key (string) is the name of the dependency.
|
|
204
204
|
* - Each value (function) is an injectable function which returns the dependency, or a promise for the dependency.
|
|
205
205
|
*
|
|
206
|
-
* This style is based on AngularJS injectable functions, but can be used with any
|
|
206
|
+
* This style is based on AngularJS injectable functions, but can be used with any Router implementation.
|
|
207
207
|
* If your code will be minified, the function should be ["annotated" in the AngularJS manner](https://docs.angularjs.org/guide/di#dependency-annotation).
|
|
208
208
|
*
|
|
209
209
|
* #### AngularJS Example:
|
|
@@ -257,7 +257,7 @@ export interface StateDeclaration {
|
|
|
257
257
|
*
|
|
258
258
|
* #### Special injectable tokens
|
|
259
259
|
*
|
|
260
|
-
* - `
|
|
260
|
+
* - `Router`: The [[Router]] instance which has references to all the Router services.
|
|
261
261
|
* - `Transition`: The current [[Transition]] object; information and API about the current transition, such as
|
|
262
262
|
* "to" and "from" State Parameters and transition options.
|
|
263
263
|
* - `'$transition$'`: A string alias for the `Transition` injectable
|
|
@@ -428,7 +428,7 @@ export interface StateDeclaration {
|
|
|
428
428
|
*
|
|
429
429
|
* Note: `redirectTo` is processed as an `onStart` hook, before `LAZY` resolves.
|
|
430
430
|
* If your redirect function relies on resolve data, get the [[Transition.injector]] and get a
|
|
431
|
-
* promise for the resolve data using [[
|
|
431
|
+
* promise for the resolve data using [[NGInjector.getAsync]].
|
|
432
432
|
*
|
|
433
433
|
* #### Example:
|
|
434
434
|
* ```js
|
|
@@ -595,7 +595,7 @@ export interface StateDeclaration {
|
|
|
595
595
|
* It matches any state name that starts with the `name` (including child states that are not yet loaded).
|
|
596
596
|
* - A `url` prefix.
|
|
597
597
|
* A future state's `url` property acts as a wildcard.
|
|
598
|
-
*
|
|
598
|
+
* Router matches all paths that begin with the `url`.
|
|
599
599
|
* It effectively appends `.*` to the internal regular expression.
|
|
600
600
|
* When the prefix matches, the future state will begin loading.
|
|
601
601
|
* - A `lazyLoad` function.
|
|
@@ -12,7 +12,7 @@ import { TargetState } from "./targetState";
|
|
|
12
12
|
import { Transition } from "../transition/transition";
|
|
13
13
|
import { Glob } from "../common/glob";
|
|
14
14
|
/**
|
|
15
|
-
* Internal representation of a
|
|
15
|
+
* Internal representation of a Router state.
|
|
16
16
|
*
|
|
17
17
|
* Instances of this class are created when a [[StateDeclaration]] is registered with the [[StateRegistry]].
|
|
18
18
|
*
|
|
@@ -2,7 +2,7 @@ import { _StateDeclaration } from "./interface";
|
|
|
2
2
|
import { StateObject } from "./stateObject";
|
|
3
3
|
import { StateBuilder } from "./stateBuilder";
|
|
4
4
|
import { StateRegistryListener } from "./stateRegistry";
|
|
5
|
-
import {
|
|
5
|
+
import { Router } from "../router";
|
|
6
6
|
export declare class StateQueueManager {
|
|
7
7
|
private router;
|
|
8
8
|
states: {
|
|
@@ -12,7 +12,7 @@ export declare class StateQueueManager {
|
|
|
12
12
|
listeners: StateRegistryListener[];
|
|
13
13
|
queue: StateObject[];
|
|
14
14
|
constructor(
|
|
15
|
-
router:
|
|
15
|
+
router: Router,
|
|
16
16
|
states: {
|
|
17
17
|
[key: string]: StateObject;
|
|
18
18
|
},
|
|
@@ -4,7 +4,7 @@ import { StateQueueManager } from "./stateQueueManager";
|
|
|
4
4
|
import { StateDeclaration, _StateDeclaration } from "./interface";
|
|
5
5
|
import { BuilderFunction } from "./stateBuilder";
|
|
6
6
|
import { StateOrName } from "./interface";
|
|
7
|
-
import {
|
|
7
|
+
import { Router } from "../router";
|
|
8
8
|
/**
|
|
9
9
|
* The signature for the callback function provided to [[StateRegistry.onStatesChanged]].
|
|
10
10
|
*
|
|
@@ -20,9 +20,10 @@ export declare type StateRegistryListener = (
|
|
|
20
20
|
/**
|
|
21
21
|
* A registry for all of the application's [[StateDeclaration]]s
|
|
22
22
|
*
|
|
23
|
-
* This API is found at `router.stateRegistry` ([[
|
|
23
|
+
* This API is found at `router.stateRegistry` ([[Router.stateRegistry]])
|
|
24
24
|
*/
|
|
25
25
|
export declare class StateRegistry {
|
|
26
|
+
init($injector: any): void;
|
|
26
27
|
private router;
|
|
27
28
|
private _root;
|
|
28
29
|
private states;
|
|
@@ -34,7 +35,7 @@ export declare class StateRegistry {
|
|
|
34
35
|
/** @internal */
|
|
35
36
|
listeners: StateRegistryListener[];
|
|
36
37
|
/** @internal */
|
|
37
|
-
constructor(router:
|
|
38
|
+
constructor(router: Router);
|
|
38
39
|
/** @internal */
|
|
39
40
|
private _registerRoot;
|
|
40
41
|
/**
|
|
@@ -72,7 +73,7 @@ export declare class StateRegistry {
|
|
|
72
73
|
* Gets the implicit root state
|
|
73
74
|
*
|
|
74
75
|
* Gets the root of the state tree.
|
|
75
|
-
* The root state is implicitly created by
|
|
76
|
+
* The root state is implicitly created by Router.
|
|
76
77
|
* Note: this returns the internal [[StateObject]] representation, not a [[StateDeclaration]]
|
|
77
78
|
*
|
|
78
79
|
* @return the root [[StateObject]]
|
|
@@ -10,18 +10,18 @@ import {
|
|
|
10
10
|
import { StateObject } from "./stateObject";
|
|
11
11
|
import { TargetState } from "./targetState";
|
|
12
12
|
import { RawParams } from "../params/interface";
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
13
|
+
import { Router } from "../router";
|
|
14
|
+
import { NGInjector } from "../interface";
|
|
15
15
|
import { StateParams } from "../params/stateParams";
|
|
16
16
|
export declare type OnInvalidCallback = (
|
|
17
17
|
toState?: TargetState,
|
|
18
18
|
fromState?: TargetState,
|
|
19
|
-
injector?:
|
|
19
|
+
injector?: NGInjector,
|
|
20
20
|
) => HookResult;
|
|
21
21
|
/**
|
|
22
22
|
* Provides services related to ui-router states.
|
|
23
23
|
*
|
|
24
|
-
* This API is located at `router.stateService` ([[
|
|
24
|
+
* This API is located at `router.stateService` ([[Router.stateService]])
|
|
25
25
|
*/
|
|
26
26
|
export declare class StateService {
|
|
27
27
|
private router;
|
|
@@ -30,29 +30,29 @@ export declare class StateService {
|
|
|
30
30
|
/**
|
|
31
31
|
* The [[Transition]] currently in progress (or null)
|
|
32
32
|
*
|
|
33
|
-
* @deprecated This is a passthrough through to [[
|
|
33
|
+
* @deprecated This is a passthrough through to [[RouterGlobals.transition]]
|
|
34
34
|
*/
|
|
35
35
|
transition: Transition;
|
|
36
36
|
/**
|
|
37
37
|
* The latest successful state parameters
|
|
38
38
|
*
|
|
39
|
-
* @deprecated This is a passthrough through to [[
|
|
39
|
+
* @deprecated This is a passthrough through to [[RouterGlobals.params]]
|
|
40
40
|
*/
|
|
41
41
|
params: StateParams;
|
|
42
42
|
/**
|
|
43
43
|
* The current [[StateDeclaration]]
|
|
44
44
|
*
|
|
45
|
-
* @deprecated This is a passthrough through to [[
|
|
45
|
+
* @deprecated This is a passthrough through to [[RouterGlobals.current]]
|
|
46
46
|
*/
|
|
47
47
|
current: StateDeclaration;
|
|
48
48
|
/**
|
|
49
49
|
* The current [[StateObject]] (an internal API)
|
|
50
50
|
*
|
|
51
|
-
* @deprecated This is a passthrough through to [[
|
|
51
|
+
* @deprecated This is a passthrough through to [[RouterGlobals.$current]]
|
|
52
52
|
*/
|
|
53
53
|
$current: StateObject;
|
|
54
54
|
/** @internal */
|
|
55
|
-
constructor(/** @internal */ router:
|
|
55
|
+
constructor(/** @internal */ router: Router);
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* Handler for when [[transitionTo]] is called with an invalid state.
|
|
@@ -99,7 +99,7 @@ export declare class StateService {
|
|
|
99
99
|
*
|
|
100
100
|
* #### Example:
|
|
101
101
|
* ```js
|
|
102
|
-
* let app angular.module('app', ['
|
|
102
|
+
* let app angular.module('app', ['ng.router']);
|
|
103
103
|
*
|
|
104
104
|
* app.controller('ctrl', function ($scope, $state) {
|
|
105
105
|
* $scope.reload = function(){
|
|
@@ -123,7 +123,7 @@ export declare class StateService {
|
|
|
123
123
|
* ```js
|
|
124
124
|
* //assuming app application consists of 3 states: 'contacts', 'contacts.detail', 'contacts.detail.item'
|
|
125
125
|
* //and current state is 'contacts.detail.item'
|
|
126
|
-
* let app angular.module('app', ['
|
|
126
|
+
* let app angular.module('app', ['ng.router']);
|
|
127
127
|
*
|
|
128
128
|
* app.controller('ctrl', function ($scope, $state) {
|
|
129
129
|
* $scope.reload = function(){
|
|
@@ -149,7 +149,7 @@ export declare class StateService {
|
|
|
149
149
|
*
|
|
150
150
|
* #### Example:
|
|
151
151
|
* ```js
|
|
152
|
-
* let app = angular.module('app', ['
|
|
152
|
+
* let app = angular.module('app', ['ng.router']);
|
|
153
153
|
*
|
|
154
154
|
* app.controller('ctrl', function ($scope, $state) {
|
|
155
155
|
* $scope.changeState = function () {
|
|
@@ -202,7 +202,7 @@ export declare class StateService {
|
|
|
202
202
|
*
|
|
203
203
|
* #### Example:
|
|
204
204
|
* ```js
|
|
205
|
-
* let app = angular.module('app', ['
|
|
205
|
+
* let app = angular.module('app', ['ng.router']);
|
|
206
206
|
*
|
|
207
207
|
* app.controller('ctrl', function ($scope, $state) {
|
|
208
208
|
* $scope.changeState = function () {
|
|
@@ -25,7 +25,7 @@ import { RawParams } from "../params";
|
|
|
25
25
|
* 3) and transition options
|
|
26
26
|
* 4) the registered state object (the [[StateDeclaration]])
|
|
27
27
|
*
|
|
28
|
-
* Many
|
|
28
|
+
* Many Router APIs such as [[StateService.go]] take a [[StateOrName]] argument which can
|
|
29
29
|
* either be a *state object* (a [[StateDeclaration]] or [[StateObject]]) or a *state name* (a string).
|
|
30
30
|
* The `TargetState` class normalizes those options.
|
|
31
31
|
*
|
|
@@ -9,7 +9,7 @@ import { RegisteredHook } from "./hookRegistry";
|
|
|
9
9
|
* The TransitionOptions object can be used to change the behavior of a transition.
|
|
10
10
|
*
|
|
11
11
|
* It is passed as the third argument to [[StateService.go]], [[StateService.transitionTo]].
|
|
12
|
-
* It can also be used with a `
|
|
12
|
+
* It can also be used with a `ngSref`.
|
|
13
13
|
*/
|
|
14
14
|
export interface TransitionOptions {
|
|
15
15
|
/**
|
|
@@ -103,7 +103,7 @@ export interface TransitionHookOptions {
|
|
|
103
103
|
*
|
|
104
104
|
* Get a TreeChanges object using [[Transition.treeChanges]]
|
|
105
105
|
*
|
|
106
|
-
* A
|
|
106
|
+
* A Router Transition is from one Path in a State Tree to another Path. For a given Transition,
|
|
107
107
|
* this object stores the "to" and "from" paths, as well as subsets of those: the "retained",
|
|
108
108
|
* "exiting" and "entering" paths.
|
|
109
109
|
*
|