@angular-wave/angular.ts 0.0.26 → 0.0.28
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/README.md +1 -2
- package/dist/angular-ts.esm.js +1 -1
- package/dist/angular-ts.umd.js +1 -1
- package/e2e/unit.spec.ts +2 -1
- package/index.html +8 -9
- package/package.json +1 -1
- package/src/core/pubsub.js +329 -0
- package/src/router/globals.js +0 -5
- package/src/router/hooks/core-resolvables.js +12 -11
- package/src/router/hooks/ignored-transition.js +1 -1
- package/src/router/hooks/lazy-load.js +40 -41
- package/src/router/hooks/redirect-to.js +32 -29
- package/src/router/hooks/update-globals.js +1 -1
- package/src/router/hooks/url.js +33 -24
- package/src/router/hooks/views.js +21 -20
- package/src/router/params/param-factory.js +17 -0
- package/src/router/params/param-types.js +0 -3
- package/src/router/router.js +78 -62
- package/src/router/services.js +2 -4
- package/src/router/state/state-queue-manager.js +5 -7
- package/src/router/state/state-registry.js +8 -10
- package/src/router/state/state-service.js +34 -33
- package/src/router/transition/hook-builder.js +2 -2
- package/src/router/transition/transition-hook.js +3 -9
- package/src/router/transition/transition-service.js +12 -30
- package/src/router/transition/transition.js +28 -25
- package/src/router/url/url-config.js +1 -49
- package/src/router/url/url-matcher-factory.js +10 -51
- package/src/router/url/url-router.js +27 -17
- package/src/router/url/url-rule.js +9 -13
- package/src/router/url/url-rules.js +3 -7
- package/src/router/url/url-service.js +134 -97
- package/src/router/view/view.js +3 -3
- package/src/shared/hof.js +1 -1
- package/test/angular.spec.js +1 -0
- package/test/aria/aria.spec.js +2 -1
- package/test/core/interval.spec.js +1 -1
- package/test/core/pubsub.spec.js +314 -0
- package/test/directive/bind.spec.js +2 -1
- package/test/directive/boolean.spec.js +4 -2
- package/test/directive/change.spec.js +1 -1
- package/test/directive/class.spec.js +1 -0
- package/test/directive/click.spec.js +2 -1
- package/test/directive/cloak.spec.js +1 -2
- package/test/directive/{constoller.spec.js → controller.spec.js} +1 -0
- package/test/directive/element-style.spec.js +1 -0
- package/test/directive/event.spec.js +1 -1
- package/test/directive/href.spec.js +2 -1
- package/test/directive/init.spec.js +1 -0
- package/test/directive/input.spec.js +200 -285
- package/test/directive/list.spec.js +2 -1
- package/test/directive/model.spec.js +1 -0
- package/test/directive/non-bindable.spec.js +2 -1
- package/test/directive/script.spec.js +1 -0
- package/test/directive/scrset.spec.js +2 -1
- package/test/directive/show-hide.spec.js +1 -0
- package/test/directive/src.spec.js +2 -1
- package/test/directive/style.spec.js +1 -0
- package/test/directive/switch.spec.js +2 -1
- package/test/directive/validators.spec.js +1 -1
- package/test/router/state-directives.spec.js +72 -72
- package/test/router/state.spec.js +5 -5
- package/test/router/template-factory.spec.js +2 -2
- package/test/router/view-directive.spec.js +65 -65
- package/test/router/view-hook.spec.js +13 -13
- package/test/router/view-scroll.spec.js +3 -3
- package/test/router/view.spec.js +2 -2
- package/types/router/core/common/coreservices.d.ts +2 -3
- package/types/router/core/globals.d.ts +1 -4
- package/types/router/core/interface.d.ts +2 -8
- package/types/router/core/params/paramTypes.d.ts +0 -1
- package/types/router/core/router.d.ts +2 -3
- package/types/router/core/state/stateQueueManager.d.ts +1 -3
- package/types/router/core/state/stateRegistry.d.ts +0 -2
- package/types/router/core/state/stateService.d.ts +1 -2
- package/types/router/core/transition/interface.d.ts +3 -3
- package/types/router/core/transition/transitionService.d.ts +1 -2
- package/types/router/core/url/urlConfig.d.ts +1 -2
- package/types/router/core/url/urlRules.d.ts +1 -2
- package/types/router/core/url/urlService.d.ts +1 -2
- package/types/router/locationServices.d.ts +0 -1
- package/src/router/location-services.js +0 -67
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dealoc } from "../../src/jqLite";
|
|
1
|
+
import { dealoc, jqLite } from "../../src/jqLite";
|
|
2
2
|
import { Angular } from "../../src/loader";
|
|
3
3
|
import { publishExternalAPI } from "../../src/public";
|
|
4
4
|
import { wait } from "../test-utils";
|
|
@@ -58,7 +58,7 @@ describe("view hooks", () => {
|
|
|
58
58
|
|
|
59
59
|
const initial = async () => {
|
|
60
60
|
$state.go("foo");
|
|
61
|
-
await wait(
|
|
61
|
+
await wait(100);
|
|
62
62
|
expect(log).toBe("");
|
|
63
63
|
expect($state.current.name).toBe("foo");
|
|
64
64
|
};
|
|
@@ -83,7 +83,7 @@ describe("view hooks", () => {
|
|
|
83
83
|
await initial();
|
|
84
84
|
|
|
85
85
|
$state.go("bar");
|
|
86
|
-
await wait(
|
|
86
|
+
await wait(100);
|
|
87
87
|
expect(log).toBe("canexit;");
|
|
88
88
|
expect($state.current.name).toBe("bar");
|
|
89
89
|
});
|
|
@@ -95,7 +95,7 @@ describe("view hooks", () => {
|
|
|
95
95
|
await initial();
|
|
96
96
|
|
|
97
97
|
$state.go("bar");
|
|
98
|
-
await wait(
|
|
98
|
+
await wait(100);
|
|
99
99
|
expect(log).toBe("canexit;");
|
|
100
100
|
expect($state.current.name).toBe("bar");
|
|
101
101
|
});
|
|
@@ -103,12 +103,12 @@ describe("view hooks", () => {
|
|
|
103
103
|
it("can redirect the transition", async () => {
|
|
104
104
|
ctrl.prototype.uiCanExit = function (trans) {
|
|
105
105
|
log += "canexit;";
|
|
106
|
-
return
|
|
106
|
+
return $state.target("baz");
|
|
107
107
|
};
|
|
108
108
|
await initial();
|
|
109
109
|
|
|
110
110
|
$state.go("bar");
|
|
111
|
-
await wait(
|
|
111
|
+
await wait(100);
|
|
112
112
|
expect(log).toBe("canexit;");
|
|
113
113
|
expect($state.current.name).toBe("baz");
|
|
114
114
|
});
|
|
@@ -122,7 +122,7 @@ describe("view hooks", () => {
|
|
|
122
122
|
|
|
123
123
|
$state.defaultErrorHandler(function () {});
|
|
124
124
|
$state.go("bar");
|
|
125
|
-
await wait(
|
|
125
|
+
await wait(100);
|
|
126
126
|
expect(log).toBe("canexit;");
|
|
127
127
|
expect($state.current.name).toBe("foo");
|
|
128
128
|
});
|
|
@@ -139,7 +139,7 @@ describe("view hooks", () => {
|
|
|
139
139
|
await initial();
|
|
140
140
|
|
|
141
141
|
$state.go("bar");
|
|
142
|
-
await wait(
|
|
142
|
+
await wait(100);
|
|
143
143
|
expect(log).toBe("canexit;delay;");
|
|
144
144
|
expect($state.current.name).toBe("foo");
|
|
145
145
|
});
|
|
@@ -154,7 +154,7 @@ describe("view hooks", () => {
|
|
|
154
154
|
await initial();
|
|
155
155
|
|
|
156
156
|
$state.go("bar");
|
|
157
|
-
await wait(
|
|
157
|
+
await wait(100);
|
|
158
158
|
expect(log).toBe("canexit;delay;");
|
|
159
159
|
expect($state.current.name).toBe("bar");
|
|
160
160
|
});
|
|
@@ -166,7 +166,7 @@ describe("view hooks", () => {
|
|
|
166
166
|
await initial();
|
|
167
167
|
|
|
168
168
|
$state.go("bar");
|
|
169
|
-
await wait(
|
|
169
|
+
await wait(100);
|
|
170
170
|
expect(log).toBe("DATA");
|
|
171
171
|
expect($state.current.name).toBe("bar");
|
|
172
172
|
});
|
|
@@ -181,7 +181,7 @@ describe("view hooks", () => {
|
|
|
181
181
|
await initial();
|
|
182
182
|
|
|
183
183
|
$state.go("bar");
|
|
184
|
-
await wait(
|
|
184
|
+
await wait(100);
|
|
185
185
|
expect(log).toBe("canexit;");
|
|
186
186
|
expect($state.current.name).toBe("bar");
|
|
187
187
|
});
|
|
@@ -195,7 +195,7 @@ describe("view hooks", () => {
|
|
|
195
195
|
await initial();
|
|
196
196
|
|
|
197
197
|
$state.go("redirect");
|
|
198
|
-
await wait(
|
|
198
|
+
await wait(100);
|
|
199
199
|
expect(log).toBe("canexit;");
|
|
200
200
|
expect($state.current.name).toBe("baz");
|
|
201
201
|
});
|
|
@@ -209,7 +209,7 @@ describe("view hooks", () => {
|
|
|
209
209
|
await initial();
|
|
210
210
|
|
|
211
211
|
$state.go("redirect");
|
|
212
|
-
await wait(
|
|
212
|
+
await wait(100);
|
|
213
213
|
expect(log).toBe("canexit;");
|
|
214
214
|
expect($state.current.name).toBe("bar");
|
|
215
215
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dealoc } from "../../src/jqLite";
|
|
1
|
+
import { dealoc, jqLite } from "../../src/jqLite";
|
|
2
2
|
import { Angular } from "../../src/loader";
|
|
3
3
|
import { publishExternalAPI } from "../../src/public";
|
|
4
4
|
import { wait } from "../test-utils";
|
|
@@ -29,14 +29,14 @@ describe("uiView", () => {
|
|
|
29
29
|
$uiViewScroll(elem);
|
|
30
30
|
expect(elem[0].scrollIntoView).not.toHaveBeenCalled();
|
|
31
31
|
|
|
32
|
-
await wait(
|
|
32
|
+
await wait(100);
|
|
33
33
|
expect(elem[0].scrollIntoView).toHaveBeenCalled();
|
|
34
34
|
});
|
|
35
35
|
|
|
36
36
|
it("should return the promise from the timeout", async () => {
|
|
37
37
|
const promise = $uiViewScroll(elem);
|
|
38
38
|
|
|
39
|
-
await wait(
|
|
39
|
+
await wait(100);
|
|
40
40
|
expect(elem[0].scrollIntoView).toHaveBeenCalled();
|
|
41
41
|
expect(promise).toBeDefined();
|
|
42
42
|
});
|
package/test/router/view.spec.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { dealoc } from "../../src/jqLite";
|
|
1
|
+
import { dealoc, jqLite } from "../../src/jqLite";
|
|
2
2
|
import { Angular } from "../../src/loader";
|
|
3
3
|
import { publishExternalAPI } from "../../src/public";
|
|
4
4
|
import { curry } from "../../src/shared/hof";
|
|
@@ -110,7 +110,7 @@ describe("view", () => {
|
|
|
110
110
|
|
|
111
111
|
const view = tail(path).views[0];
|
|
112
112
|
view.load();
|
|
113
|
-
await wait(
|
|
113
|
+
await wait(100);
|
|
114
114
|
expect(ctrlExpression).toEqual("FooController as foo");
|
|
115
115
|
});
|
|
116
116
|
});
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* @packageDocumentation
|
|
6
6
|
*/
|
|
7
7
|
import { IInjectable, Obj } from "./common";
|
|
8
|
-
import { Disposable } from "../interface";
|
|
9
8
|
import { UrlConfig, UrlService } from "../url";
|
|
10
9
|
export declare const makeStub: <T>(service: string, methods: (keyof T)[]) => T;
|
|
11
10
|
declare const services: CoreServices;
|
|
@@ -46,7 +45,7 @@ export interface CoreServices {
|
|
|
46
45
|
* - [[HashLocationService]]
|
|
47
46
|
* - [[MemoryLocationService]]
|
|
48
47
|
*/
|
|
49
|
-
export interface LocationServices
|
|
48
|
+
export interface LocationServices {
|
|
50
49
|
/** See: [[UrlService.url]] */ url: UrlService["url"];
|
|
51
50
|
/** See: [[UrlService.path]] */ path: UrlService["path"];
|
|
52
51
|
/** See: [[UrlService.search]] */ search: UrlService["search"];
|
|
@@ -67,7 +66,7 @@ export interface LocationServices extends Disposable {
|
|
|
67
66
|
* - [[BrowserLocationConfig]]
|
|
68
67
|
* - [[MemoryLocationConfig]]
|
|
69
68
|
*/
|
|
70
|
-
export interface LocationConfig
|
|
69
|
+
export interface LocationConfig {
|
|
71
70
|
/** See: [[UrlConfig.port]] */ port: UrlConfig["port"];
|
|
72
71
|
/** See: [[UrlConfig.protocol]] */ protocol: UrlConfig["protocol"];
|
|
73
72
|
/** See: [[UrlConfig.host]] */ host: UrlConfig["host"];
|
|
@@ -3,14 +3,12 @@ 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
|
-
import { Disposable } from "./interface";
|
|
7
|
-
/**
|
|
8
6
|
* Global router state
|
|
9
7
|
*
|
|
10
8
|
* This is where we hold the global mutable state such as current state, current
|
|
11
9
|
* params, current transition, etc.
|
|
12
10
|
*/
|
|
13
|
-
export declare class UIRouterGlobals
|
|
11
|
+
export declare class UIRouterGlobals {
|
|
14
12
|
/**
|
|
15
13
|
* Current parameter values
|
|
16
14
|
*
|
|
@@ -41,5 +39,4 @@ export declare class UIRouterGlobals implements Disposable {
|
|
|
41
39
|
transitionHistory: Queue<Transition>;
|
|
42
40
|
/** @internal */
|
|
43
41
|
successfulTransitions: Queue<Transition>;
|
|
44
|
-
dispose(): void;
|
|
45
42
|
}
|
|
@@ -89,16 +89,10 @@ export interface UIInjector {
|
|
|
89
89
|
getNative(token: any): any;
|
|
90
90
|
getNative<T>(token: any): T;
|
|
91
91
|
}
|
|
92
|
-
export interface UIRouterPlugin
|
|
92
|
+
export interface UIRouterPlugin {
|
|
93
93
|
name: string;
|
|
94
94
|
}
|
|
95
|
-
export declare abstract class UIRouterPluginBase
|
|
96
|
-
implements UIRouterPlugin, Disposable
|
|
97
|
-
{
|
|
95
|
+
export declare abstract class UIRouterPluginBase implements UIRouterPlugin {
|
|
98
96
|
abstract name: string;
|
|
99
97
|
dispose(router: UIRouter): void;
|
|
100
98
|
}
|
|
101
|
-
export interface Disposable {
|
|
102
|
-
/** Instructs the Disposable to clean up any resources */
|
|
103
|
-
dispose(router?: UIRouter): any;
|
|
104
|
-
}
|
|
@@ -5,7 +5,7 @@ import { ViewService } from "./view/view";
|
|
|
5
5
|
import { StateRegistry } from "./state/stateRegistry";
|
|
6
6
|
import { StateService } from "./state/stateService";
|
|
7
7
|
import { UIRouterGlobals } from "./globals";
|
|
8
|
-
import { UIRouterPlugin
|
|
8
|
+
import { UIRouterPlugin } from "./interface";
|
|
9
9
|
import { UrlService } from "./url/urlService";
|
|
10
10
|
import { LocationServices, LocationConfig } from "./common/coreservices";
|
|
11
11
|
import { Trace } from "./common/trace";
|
|
@@ -46,8 +46,7 @@ export declare class UIRouter {
|
|
|
46
46
|
stateService: StateService;
|
|
47
47
|
/** @internal plugin instances are registered here */
|
|
48
48
|
private _plugins;
|
|
49
|
-
|
|
50
|
-
disposable(disposable: Disposable): void;
|
|
49
|
+
|
|
51
50
|
/**
|
|
52
51
|
* Disposes this router instance
|
|
53
52
|
*
|
|
@@ -2,9 +2,8 @@ import { _StateDeclaration } from "./interface";
|
|
|
2
2
|
import { StateObject } from "./stateObject";
|
|
3
3
|
import { StateBuilder } from "./stateBuilder";
|
|
4
4
|
import { StateRegistryListener } from "./stateRegistry";
|
|
5
|
-
import { Disposable } from "../interface";
|
|
6
5
|
import { UIRouter } from "../router";
|
|
7
|
-
export declare class StateQueueManager
|
|
6
|
+
export declare class StateQueueManager {
|
|
8
7
|
private router;
|
|
9
8
|
states: {
|
|
10
9
|
[key: string]: StateObject;
|
|
@@ -20,7 +19,6 @@ export declare class StateQueueManager implements Disposable {
|
|
|
20
19
|
builder: StateBuilder,
|
|
21
20
|
listeners: StateRegistryListener[],
|
|
22
21
|
);
|
|
23
|
-
dispose(): void;
|
|
24
22
|
register(stateDecl: _StateDeclaration): StateObject;
|
|
25
23
|
flush(): {
|
|
26
24
|
[key: string]: StateObject;
|
|
@@ -53,8 +53,7 @@ export declare class StateService {
|
|
|
53
53
|
$current: StateObject;
|
|
54
54
|
/** @internal */
|
|
55
55
|
constructor(/** @internal */ router: UIRouter);
|
|
56
|
-
|
|
57
|
-
dispose(): void;
|
|
56
|
+
|
|
58
57
|
/**
|
|
59
58
|
* Handler for when [[transitionTo]] is called with an invalid state.
|
|
60
59
|
*
|
|
@@ -327,7 +327,7 @@ export interface IHookRegistry {
|
|
|
327
327
|
* ```js
|
|
328
328
|
* // ng2
|
|
329
329
|
* transitionService.onBefore({ to: 'home' }, (trans: Transition) =>
|
|
330
|
-
*
|
|
330
|
+
* stateService.target("home.dashboard"));
|
|
331
331
|
* ```
|
|
332
332
|
*
|
|
333
333
|
* #### Data Driven Default Substate
|
|
@@ -354,7 +354,7 @@ export interface IHookRegistry {
|
|
|
354
354
|
*
|
|
355
355
|
* $transitions.onBefore(criteria, function(trans: Transition) {
|
|
356
356
|
* var substate = trans.to().defaultSubstate;
|
|
357
|
-
* return
|
|
357
|
+
* return stateService.target(substate);
|
|
358
358
|
* });
|
|
359
359
|
* ```
|
|
360
360
|
*
|
|
@@ -429,7 +429,7 @@ export interface IHookRegistry {
|
|
|
429
429
|
* ```js
|
|
430
430
|
* // ng1
|
|
431
431
|
* $transitions.onStart( { to: 'auth.**' }, function(trans) {
|
|
432
|
-
* var $state =
|
|
432
|
+
* var $state = stateService;
|
|
433
433
|
* var MyAuthService = trans.injector().get('MyAuthService');
|
|
434
434
|
*
|
|
435
435
|
* // If the user is not authenticated
|
|
@@ -20,7 +20,6 @@ import { ViewService } from "../view/view";
|
|
|
20
20
|
import { UIRouter } from "../router";
|
|
21
21
|
import { TransitionEventType } from "./transitionEventType";
|
|
22
22
|
import { GetResultHandler, GetErrorHandler } from "./transitionHook";
|
|
23
|
-
import { Disposable } from "../interface";
|
|
24
23
|
/**
|
|
25
24
|
* The default [[Transition]] options.
|
|
26
25
|
*
|
|
@@ -82,7 +81,7 @@ export interface TransitionServicePluginAPI {
|
|
|
82
81
|
*
|
|
83
82
|
* This API is located at `router.transitionService` ([[UIRouter.transitionService]])
|
|
84
83
|
*/
|
|
85
|
-
export declare class TransitionService implements IHookRegistry
|
|
84
|
+
export declare class TransitionService implements IHookRegistry {
|
|
86
85
|
/** @internal */
|
|
87
86
|
_transitionCount: number;
|
|
88
87
|
/** @internal */
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Disposable } from "../interface";
|
|
2
1
|
import { UIRouter } from "../router";
|
|
3
2
|
import { ParamTypeDefinition, ParamTypes } from "../params";
|
|
4
3
|
/**
|
|
@@ -14,7 +13,7 @@ import { ParamTypeDefinition, ParamTypes } from "../params";
|
|
|
14
13
|
*
|
|
15
14
|
* This API is found at `router.urlService.config` (see: [[UIRouter.urlService]], [[URLService.config]])
|
|
16
15
|
*/
|
|
17
|
-
export declare class UrlConfig
|
|
16
|
+
export declare class UrlConfig {
|
|
18
17
|
private router;
|
|
19
18
|
/** @internal */ paramTypes: ParamTypes;
|
|
20
19
|
/** @internal */ _decodeParams: boolean;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UIRouter } from "../router";
|
|
2
|
-
import { Disposable } from "../interface";
|
|
3
2
|
import { UrlRule, UrlRuleHandlerFn } from "./interface";
|
|
4
3
|
import { TargetState, TargetStateDef } from "../state";
|
|
5
4
|
import { UrlMatcher } from "./urlMatcher";
|
|
@@ -14,7 +13,7 @@ import { UrlRuleFactory } from "./urlRule";
|
|
|
14
13
|
*
|
|
15
14
|
* This API is found at `router.urlService.rules` (see: [[UIRouter.urlService]], [[URLService.rules]])
|
|
16
15
|
*/
|
|
17
|
-
export declare class UrlRules
|
|
16
|
+
export declare class UrlRules {
|
|
18
17
|
private router;
|
|
19
18
|
/** used to create [[UrlRule]] objects for common cases */
|
|
20
19
|
urlRuleFactory: UrlRuleFactory;
|
|
@@ -35,7 +35,6 @@ export declare class Ng1LocationServices
|
|
|
35
35
|
* @param router
|
|
36
36
|
*/
|
|
37
37
|
static monkeyPatchPathParameterType(router: UIRouter): void;
|
|
38
|
-
dispose(): void;
|
|
39
38
|
constructor($locationProvider: ILocationProvider);
|
|
40
39
|
onChange(callback: Function): () => Function[];
|
|
41
40
|
html5Mode(): any;
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { isDefined, isObject } from "../shared/utils";
|
|
2
|
-
import { val } from "../shared/hof";
|
|
3
|
-
import { createProxyFunctions, removeFrom } from "../shared/common";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Implements UI-Router LocationServices and LocationConfig using Angular 1's $location service
|
|
7
|
-
* @internalapi
|
|
8
|
-
*/
|
|
9
|
-
export class Ng1LocationServices {
|
|
10
|
-
/**
|
|
11
|
-
*
|
|
12
|
-
* @param {angular.ILocationProvider} $locationProvider
|
|
13
|
-
*/
|
|
14
|
-
constructor($locationProvider) {
|
|
15
|
-
// .onChange() registry
|
|
16
|
-
this._urlListeners = [];
|
|
17
|
-
/** @type {angular.ILocationProvider} */
|
|
18
|
-
this.$locationProvider = $locationProvider;
|
|
19
|
-
const _lp = val($locationProvider);
|
|
20
|
-
createProxyFunctions(_lp, this, _lp, ["hashPrefix"]);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
dispose() {}
|
|
24
|
-
|
|
25
|
-
onChange(callback) {
|
|
26
|
-
this._urlListeners.push(callback);
|
|
27
|
-
return () => removeFrom(this._urlListeners)(callback);
|
|
28
|
-
}
|
|
29
|
-
html5Mode() {
|
|
30
|
-
let html5Mode = this.$locationProvider.html5Mode();
|
|
31
|
-
html5Mode = isObject(html5Mode) ? html5Mode.enabled : html5Mode;
|
|
32
|
-
return html5Mode && typeof history !== "undefined";
|
|
33
|
-
}
|
|
34
|
-
baseHref() {
|
|
35
|
-
return (
|
|
36
|
-
this._baseHref ||
|
|
37
|
-
(this._baseHref =
|
|
38
|
-
this.$browser.baseHref() || this.$window.location.pathname)
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
url(newUrl, replace = false, state) {
|
|
42
|
-
if (isDefined(newUrl)) this.$location.url(newUrl);
|
|
43
|
-
if (replace) this.$location.replace();
|
|
44
|
-
if (state) this.$location.state(state);
|
|
45
|
-
return this.$location.url();
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
_runtimeServices($rootScope, $location, $browser) {
|
|
49
|
-
/** @type {angular.ILocationService} */ this.$location = $location;
|
|
50
|
-
this.$browser = $browser;
|
|
51
|
-
this.$window = window;
|
|
52
|
-
// Bind $locationChangeSuccess to the listeners registered in LocationService.onChange
|
|
53
|
-
$rootScope.$on("$locationChangeSuccess", (evt) =>
|
|
54
|
-
this._urlListeners.forEach((fn) => fn(evt)),
|
|
55
|
-
);
|
|
56
|
-
const _loc = val($location);
|
|
57
|
-
// Bind these LocationService functions to $location
|
|
58
|
-
createProxyFunctions(_loc, this, _loc, [
|
|
59
|
-
"replace",
|
|
60
|
-
"path",
|
|
61
|
-
"search",
|
|
62
|
-
"hash",
|
|
63
|
-
]);
|
|
64
|
-
// Bind these LocationConfig functions to $location
|
|
65
|
-
createProxyFunctions(_loc, this, _loc, ["port", "protocol", "host"]);
|
|
66
|
-
}
|
|
67
|
-
}
|