@angular-wave/angular.ts 0.7.8 → 0.8.0
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/core/parse/parse.d.ts +6 -7
- package/@types/directive/bind/bind.d.ts +2 -1
- package/@types/index.d.ts +1 -1
- package/@types/interface.d.ts +3 -1
- package/@types/{public.d.ts → ng.d.ts} +2 -2
- package/@types/router/globals.d.ts +1 -1
- package/@types/router/path/path-utils.d.ts +8 -11
- package/@types/router/state/interface.d.ts +1 -1
- package/@types/router/state/state-object.d.ts +1 -1
- package/@types/router/state/state-service.d.ts +8 -7
- package/@types/router/state-filters.d.ts +24 -2
- package/@types/router/transition/transition.d.ts +12 -15
- package/@types/router/url/url-matcher.d.ts +3 -3
- package/@types/router/url/url-rule.d.ts +1 -0
- package/@types/router/url/url-rules.d.ts +26 -6
- package/@types/router/url/url-service.d.ts +28 -38
- package/@types/services/http/http.d.ts +48 -1
- package/@types/services/http-backend/http-backend.d.ts +48 -35
- package/@types/services/location/interface.d.ts +55 -0
- package/@types/services/location/location.d.ts +225 -252
- package/@types/shared/common.d.ts +0 -2
- package/@types/shared/interface.d.ts +0 -4
- package/@types/{router/common → shared}/queue.d.ts +2 -2
- package/@types/shared/url-utils/interface.d.ts +0 -1
- package/@types/shared/url-utils/url-utils.d.ts +0 -5
- package/@types/shared/utils.d.ts +29 -6
- package/Makefile +6 -3
- package/dist/angular-ts.esm.js +960 -1062
- package/dist/angular-ts.umd.js +960 -1062
- package/dist/angular-ts.umd.min.js +1 -1
- package/docs/assets/scss/index.scss +23 -0
- package/docs/content/_index.md +9 -8
- package/docs/content/docs/_index.md +1 -1
- package/docs/content/docs/directive/app.md +1 -1
- package/docs/content/docs/directive/bind.md +1 -1
- package/docs/content/docs/directive/blur.md +1 -1
- package/docs/content/docs/directive/channel.md +2 -2
- package/docs/content/docs/directive/class-even.md +1 -1
- package/docs/content/docs/directive/class-odd.md +1 -1
- package/docs/content/docs/directive/class.md +1 -1
- package/docs/content/docs/directive/click.md +1 -1
- package/docs/content/docs/directive/copy.md +1 -1
- package/docs/content/docs/directive/cut.md +1 -1
- package/docs/content/docs/directive/dblclick.md +1 -1
- package/docs/content/docs/directive/focus.md +1 -1
- package/docs/content/docs/directive/get.md +3 -3
- package/docs/content/docs/directive/keydown.md +1 -1
- package/docs/content/docs/directive/keyup.md +1 -1
- package/docs/content/docs/directive/load.md +1 -1
- package/docs/content/docs/directive/mousedown.md +1 -1
- package/docs/content/docs/directive/mouseenter.md +1 -1
- package/docs/content/docs/directive/mouseleave.md +1 -1
- package/docs/content/docs/directive/mousemove.md +1 -1
- package/docs/content/docs/directive/mouseout.md +1 -1
- package/docs/content/docs/directive/mouseover.md +1 -1
- package/docs/content/docs/directive/mouseup.md +1 -1
- package/docs/content/docs/directive/non-bindable.md +28 -0
- package/docs/content/docs/provider/locationProvider.md +26 -0
- package/docs/content/docs/provider/templateCacheProvider.md +2 -2
- package/docs/content/docs/service/location.md +57 -0
- package/docs/content/docs/service/url.md +5 -0
- package/docs/layouts/partials/hooks/head-end.html +1 -1
- package/docs/layouts/shortcodes/version.html +1 -0
- package/docs/static/examples/counter/counter-test.html +0 -4
- package/docs/static/examples/eventbus/eventbus-test.html +0 -4
- package/docs/static/examples/ng-non-bindable/ng-non-bindable-test.html +13 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.html +3 -0
- package/docs/static/examples/ng-non-bindable/ng-non-bindable.test.js +11 -0
- package/docs/static/typedoc/assets/highlight.css +6 -6
- package/docs/static/typedoc/assets/navigation.js +1 -1
- package/docs/static/typedoc/assets/search.js +1 -1
- package/docs/static/typedoc/classes/Location.html +55 -0
- package/docs/static/typedoc/classes/LocationProvider.html +20 -0
- package/docs/static/typedoc/index.html +1 -1
- package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
- package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
- package/docs/static/typedoc/interfaces/Provider.html +2 -1
- package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
- package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
- package/docs/static/typedoc/types/Expression.html +1 -1
- package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
- package/docs/static/version.js +13 -0
- package/docs/test-results/.last-run.json +4 -0
- package/docs/test-results/static-examples-counter-counter-counter-example/error-context.md +50 -0
- package/package.json +1 -1
- package/src/{loader.js → angular.js} +1 -1
- package/src/angular.spec.js +189 -21
- package/src/animations/animate-css.js +17 -18
- package/src/animations/animate.spec.js +1 -1
- package/src/animations/shared.js +2 -3
- package/src/binding.spec.js +1 -1
- package/src/core/compile/compile.js +4 -7
- package/src/core/compile/compile.spec.js +1 -1
- package/src/core/controller/controller.spec.js +1 -1
- package/src/core/controller/controller.test.js +1 -0
- package/src/core/di/injector.js +7 -8
- package/src/core/di/injector.spec.js +2 -2
- package/src/core/di/injector.test.js +2 -2
- package/src/core/di/internal-injector.js +3 -6
- package/src/core/filter/filter.js +1 -1
- package/src/core/filter/filter.spec.js +1 -1
- package/src/core/filter/filter.test.js +1 -0
- package/src/core/interpolate/interpolate.js +4 -6
- package/src/core/interpolate/interpolate.spec.js +1 -1
- package/src/core/interpolate/interpolate.test.js +1 -0
- package/src/core/parse/ast/ast.spec.js +1 -1
- package/src/core/parse/ast/ast.test.js +1 -1
- package/src/core/parse/lexer/lexer.spec.js +1 -1
- package/src/core/parse/parse.js +150 -146
- package/src/core/parse/parse.spec.js +17 -16
- package/src/core/prop.spec.js +1 -1
- package/src/core/root-element.spec.js +1 -1
- package/src/core/scope/scope.js +10 -11
- package/src/core/scope/scope.spec.js +3 -4
- package/src/directive/aria/aria.spec.js +1 -1
- package/src/directive/aria/aria.test.js +1 -0
- package/src/directive/attrs/attrs.spec.js +1 -1
- package/src/directive/attrs/attrs.test.js +1 -0
- package/src/directive/attrs/boolean.spec.js +1 -1
- package/src/directive/attrs/boolean.test.js +1 -0
- package/src/directive/attrs/element-style.spec.js +1 -1
- package/src/directive/attrs/element-style.test.js +1 -0
- package/src/directive/attrs/src.spec.js +1 -1
- package/src/directive/attrs/src.test.js +1 -0
- package/src/directive/bind/bind-html.spec.js +1 -1
- package/src/directive/bind/bind.js +1 -0
- package/src/directive/bind/bind.spec.js +1 -1
- package/src/directive/bind/bind.test.js +1 -0
- package/src/directive/channel/channel.spec.js +1 -1
- package/src/directive/channel/channel.test.js +1 -0
- package/src/directive/class/class.spec.js +1 -1
- package/src/directive/class/class.test.js +1 -0
- package/src/directive/cloak/cloak.spec.js +1 -1
- package/src/directive/cloak/cloak.test.js +1 -0
- package/src/directive/controller/controller.spec.js +1 -1
- package/src/directive/controller/controller.test.js +1 -0
- package/src/directive/events/click.spec.js +1 -1
- package/src/directive/events/event.spec.js +1 -1
- package/src/directive/events/events.test.js +1 -0
- package/src/directive/form/form.js +8 -5
- package/src/directive/form/form.spec.js +1 -1
- package/src/directive/form/form.test.js +1 -0
- package/src/directive/http/delete.spec.js +1 -1
- package/src/directive/http/form-test.html +18 -0
- package/src/directive/http/get.spec.js +1 -1
- package/src/directive/http/http.js +12 -3
- package/src/directive/http/post.spec.js +504 -9
- package/src/directive/http/put.spec.js +1 -1
- package/src/directive/if/if.spec.js +1 -1
- package/src/directive/include/include.spec.js +1 -1
- package/src/directive/init/init.spec.js +1 -1
- package/src/directive/init/init.test.js +1 -0
- package/src/directive/input/input.js +13 -15
- package/src/directive/input/input.spec.js +1 -2
- package/src/directive/input/input.test.js +1 -0
- package/src/directive/messages/messages.spec.js +1 -1
- package/src/directive/messages/messages.test.js +1 -0
- package/src/directive/model/model.js +13 -13
- package/src/directive/model/model.spec.js +1 -1
- package/src/directive/model/model.test.js +1 -0
- package/src/directive/model-options/model-option.test.js +1 -0
- package/src/directive/model-options/model-options.js +1 -1
- package/src/directive/model-options/model-options.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.spec.js +1 -1
- package/src/directive/non-bindable/non-bindable.test.js +1 -0
- package/src/directive/observe/observe.spec.js +1 -1
- package/src/directive/observe/observe.test.js +1 -0
- package/src/directive/on/on.spec.js +1 -1
- package/src/directive/on/on.test.js +1 -0
- package/src/directive/options/options.spec.js +1 -1
- package/src/directive/options/options.test.js +1 -0
- package/src/directive/ref/href.spec.js +1 -1
- package/src/directive/ref/href.test.js +2 -0
- package/src/directive/ref/ref.spec.js +1 -1
- package/src/directive/repeat/repeat.spec.js +2 -3
- package/src/directive/repeat/repeat.test.js +1 -0
- package/src/directive/script/script.spec.js +1 -1
- package/src/directive/script/script.test.js +1 -0
- package/src/directive/select/select.js +1 -1
- package/src/directive/select/select.spec.js +1 -1
- package/src/directive/select/select.test.js +1 -0
- package/src/directive/setter/setter.spec.js +1 -1
- package/src/directive/setter/setter.test.js +1 -0
- package/src/directive/show-hide/show-hide.spec.js +1 -1
- package/src/directive/show-hide/show-hide.test.js +1 -0
- package/src/directive/style/style.spec.js +1 -1
- package/src/directive/style/style.test.js +1 -0
- package/src/directive/switch/switch.spec.js +1 -1
- package/src/directive/switch/switch.test.js +1 -0
- package/src/directive/validators/validators.js +82 -84
- package/src/directive/validators/validators.spec.js +5 -4
- package/src/directive/validators/validators.test.js +1 -0
- package/src/filters/filter.spec.js +1 -1
- package/src/filters/filters.spec.js +1 -1
- package/src/filters/limit-to.js +2 -3
- package/src/filters/limit-to.spec.js +1 -1
- package/src/filters/order-by.spec.js +1 -1
- package/src/index.js +1 -1
- package/src/injection-tokens.js +5 -1
- package/src/interface.ts +3 -1
- package/src/loader.md +0 -155
- package/src/{public.js → ng.js} +7 -8
- package/src/{public.spec.js → ng.spec.js} +1 -1
- package/src/router/directives/state-directives.spec.js +8 -7
- package/src/router/directives/view-directive.js +2 -8
- package/src/router/directives/view-directive.spec.js +8 -9
- package/src/router/{common/common.html → glob/glob.html} +2 -3
- package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
- package/src/router/globals.js +1 -1
- package/src/router/path/path-utils.js +5 -0
- package/src/router/router-test-hashbang.html +45 -0
- package/src/router/services.spec.js +5 -6
- package/src/router/state/interface.ts +1 -1
- package/src/router/state/state-builder.js +3 -3
- package/src/router/state/state-builder.spec.js +1 -1
- package/src/router/state/state-object.js +1 -1
- package/src/router/state/state-registry.js +2 -2
- package/src/router/state/state-service.js +13 -10
- package/src/router/state/state.spec.js +23 -22
- package/src/router/state/state.test.js +1 -0
- package/src/router/state/views.js +1 -1
- package/src/router/state-filter.spec.js +1 -1
- package/src/router/state-filters.js +13 -9
- package/src/router/template-factory.js +5 -4
- package/src/router/template-factory.spec.js +1 -1
- package/src/router/transition/hook-registry.js +1 -1
- package/src/router/transition/transition-service.js +6 -5
- package/src/router/transition/transition.js +4 -4
- package/src/router/url/url-matcher.js +3 -3
- package/src/router/url/url-rule.js +1 -0
- package/src/router/url/url-rules.js +8 -5
- package/src/router/url/url-service.js +77 -76
- package/src/router/url/url-service.spec.js +55 -39
- package/src/router/url/url.test.js +1 -0
- package/src/router/view/view.js +4 -5
- package/src/router/view/view.spec.js +10 -12
- package/src/router/view/view.test.js +1 -0
- package/src/router/view-hook.spec.js +1 -1
- package/src/router/view-scroll.spec.js +1 -1
- package/src/services/anchor-scroll.html +2 -2
- package/src/services/anchor-scroll.js +5 -4
- package/src/services/http/http.js +9 -4
- package/src/services/http/http.spec.js +2 -7
- package/src/services/http/template-request.spec.js +1 -1
- package/src/services/http-backend/http-backend.js +51 -77
- package/src/services/http-backend/http-backend.spec.js +1 -2
- package/src/services/http-backend/http-backend.test.js +1 -0
- package/src/services/location/interface.ts +62 -0
- package/src/services/location/location.js +433 -520
- package/src/services/location/location.spec.js +909 -530
- package/src/services/location/location.test.js +2 -2
- package/src/services/log/log.spec.js +1 -1
- package/src/services/log/log.test.js +1 -0
- package/src/services/pubsub/pubsub.spec.js +1 -1
- package/src/services/sce/sce.js +5 -7
- package/src/services/sce/sce.md +2 -2
- package/src/services/sce/sce.spec.js +1 -1
- package/src/services/template-cache/template-cache.spec.js +1 -1
- package/src/services/template-cache/template-cache.test.js +1 -0
- package/src/shared/common.js +0 -5
- package/src/shared/common.spec.js +1 -1
- package/src/shared/interface.ts +0 -4
- package/src/{router/common → shared}/queue.js +7 -7
- package/src/shared/shared.html +1 -0
- package/src/shared/shared.test.js +1 -0
- package/src/shared/url-utils/interface.ts +0 -2
- package/src/shared/url-utils/url-utils.js +6 -30
- package/src/shared/url-utils/url-utils.spec.js +10 -9
- package/src/shared/utils.js +32 -9
- package/src/shared/utils.spec.js +35 -1
- package/src/src.html +1 -2
- package/typedoc.json +0 -1
- package/utils/express.js +27 -1
- package/utils/version.cjs +23 -0
- package/@types/router/state-provider.d.ts +0 -123
- package/src/directive/non-bindable/non-bindable.md +0 -17
- package/src/loader.spec.js +0 -169
- package/src/router/state-provider.js +0 -146
- package/src/services/location/location.md +0 -114
- package/src/shared/url-utils/url-utils.md +0 -46
- /package/@types/{loader.d.ts → angular.d.ts} +0 -0
- /package/@types/router/{common → glob}/glob.d.ts +0 -0
- /package/src/router/{common → glob}/glob.js +0 -0
- /package/src/router/{common → glob}/glob.spec.js +0 -0
- /package/src/{router/common → shared}/queue.spec.js +0 -0
|
@@ -13,44 +13,43 @@ import { UrlMatcher } from "./url-matcher.js";
|
|
|
13
13
|
import { ParamFactory } from "../params/param-factory.js";
|
|
14
14
|
import { UrlRuleFactory } from "./url-rule.js";
|
|
15
15
|
import { getBaseHref } from "../../shared/dom.js";
|
|
16
|
+
import { $injectTokens as $t, provider } from "../../injection-tokens.js";
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* API for URL management
|
|
19
20
|
*/
|
|
20
21
|
export class UrlService {
|
|
21
|
-
static $inject = [
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
];
|
|
22
|
+
static $inject = provider([
|
|
23
|
+
$t.$location,
|
|
24
|
+
$t.$state,
|
|
25
|
+
$t.$routerGlobals,
|
|
26
|
+
$t.$urlConfig,
|
|
27
|
+
]);
|
|
28
|
+
|
|
29
|
+
/** @type {import("../../services/location/location").Location} */
|
|
30
|
+
$location;
|
|
27
31
|
|
|
28
32
|
/**
|
|
29
33
|
* @param {import("../../services/location/location").LocationProvider} $locationProvider
|
|
30
34
|
* @param {import("../../router/state/state-service.js").StateProvider} stateService
|
|
31
|
-
* @param globals
|
|
35
|
+
* @param {import("../../router/globals.js").RouterGlobals} globals
|
|
32
36
|
* @param {import("../../router/url/url-config.js").UrlConfigProvider} urlConfigProvider
|
|
33
37
|
*/
|
|
34
38
|
constructor($locationProvider, stateService, globals, urlConfigProvider) {
|
|
39
|
+
this.$locationProvider = $locationProvider;
|
|
35
40
|
this.stateService = stateService;
|
|
36
41
|
this.stateService.urlService = this; // circular wiring
|
|
37
|
-
this.$locationProvider = $locationProvider;
|
|
38
|
-
this.$location = undefined;
|
|
39
42
|
|
|
40
43
|
/** Provides services related to the URL */
|
|
41
44
|
this.urlRuleFactory = new UrlRuleFactory(this, this.stateService, globals);
|
|
42
45
|
|
|
43
46
|
/**
|
|
44
47
|
* The nested [[UrlRules]] API for managing URL rules and rewrites
|
|
45
|
-
*
|
|
46
|
-
* See: [[UrlRules]] for details
|
|
47
48
|
* @type {UrlRules}
|
|
48
49
|
*/
|
|
49
50
|
this.rules = new UrlRules(this.urlRuleFactory);
|
|
50
51
|
/**
|
|
51
52
|
* The nested [[UrlConfig]] API to configure the URL and retrieve URL information
|
|
52
|
-
*
|
|
53
|
-
* See: [[UrlConfig]] for details
|
|
54
53
|
* @type {import("./url-config.js").UrlConfigProvider}
|
|
55
54
|
*/
|
|
56
55
|
this.config = urlConfigProvider;
|
|
@@ -58,37 +57,44 @@ export class UrlService {
|
|
|
58
57
|
/** Creates a new [[Param]] for a given location (DefType) */
|
|
59
58
|
this.paramFactory = new ParamFactory(this.config);
|
|
60
59
|
|
|
61
|
-
/**
|
|
62
|
-
* Gets the path part of the current url
|
|
63
|
-
*
|
|
64
|
-
* If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`
|
|
65
|
-
*
|
|
66
|
-
* @return the path portion of the url
|
|
67
|
-
*/
|
|
68
|
-
this.path = () => this.$location.path();
|
|
69
|
-
/**
|
|
70
|
-
* Gets the search part of the current url as an object
|
|
71
|
-
*
|
|
72
|
-
* If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`
|
|
73
|
-
*
|
|
74
|
-
* @return the search (query) portion of the url, as an object
|
|
75
|
-
*/
|
|
76
|
-
this.search = () => this.$location.search();
|
|
77
|
-
/**
|
|
78
|
-
* Gets the hash part of the current url
|
|
79
|
-
*
|
|
80
|
-
* If the current URL is `/some/path?query=value#anchor`, this returns `anchor`
|
|
81
|
-
*
|
|
82
|
-
* @return the hash (anchor) portion of the url
|
|
83
|
-
*/
|
|
84
|
-
this.hash = () => this.$location.hash();
|
|
85
|
-
|
|
86
60
|
this._urlListeners = [];
|
|
87
61
|
}
|
|
88
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Gets the path part of the current url
|
|
65
|
+
*
|
|
66
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `/some/path`
|
|
67
|
+
*
|
|
68
|
+
* @return {string} the path portion of the url
|
|
69
|
+
*/
|
|
70
|
+
getPath() {
|
|
71
|
+
return this.$location.getPath();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Gets the search part of the current url as an object
|
|
76
|
+
*
|
|
77
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `{ query: 'value' }`
|
|
78
|
+
*
|
|
79
|
+
* @return {Object} the search (query) portion of the url, as an object
|
|
80
|
+
*/
|
|
81
|
+
getSearch() {
|
|
82
|
+
return this.$location.getSearch();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Gets the hash part of the current url
|
|
86
|
+
*
|
|
87
|
+
* If the current URL is `/some/path?query=value#anchor`, this returns `anchor`
|
|
88
|
+
*
|
|
89
|
+
* @return {string} the hash (anchor) portion of the url
|
|
90
|
+
*/
|
|
91
|
+
getHash() {
|
|
92
|
+
return this.$location.getHash();
|
|
93
|
+
}
|
|
94
|
+
|
|
89
95
|
$get = [
|
|
90
|
-
|
|
91
|
-
|
|
96
|
+
$t.$location,
|
|
97
|
+
$t.$rootScope,
|
|
92
98
|
/**
|
|
93
99
|
*
|
|
94
100
|
* @param {import('../../services/location/location.js').Location} $location
|
|
@@ -102,21 +108,14 @@ export class UrlService {
|
|
|
102
108
|
fn(evt);
|
|
103
109
|
});
|
|
104
110
|
});
|
|
105
|
-
this.listen();
|
|
111
|
+
this.listen(true);
|
|
106
112
|
return this;
|
|
107
113
|
},
|
|
108
114
|
];
|
|
109
115
|
|
|
110
116
|
/**
|
|
111
|
-
* @returns {
|
|
117
|
+
* @returns {string}
|
|
112
118
|
*/
|
|
113
|
-
html5Mode() {
|
|
114
|
-
return (
|
|
115
|
-
this.$locationProvider.getHtml5Mode().enabled &&
|
|
116
|
-
typeof history !== "undefined"
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
119
|
baseHref() {
|
|
121
120
|
return (
|
|
122
121
|
this._baseHref ||
|
|
@@ -171,20 +170,18 @@ export class UrlService {
|
|
|
171
170
|
* @param {string} [newUrl] The new value for the URL.
|
|
172
171
|
* This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.
|
|
173
172
|
* It should not include the protocol, site, port, or base path of an absolute HREF.
|
|
174
|
-
* @param {boolean} [replace] When true, replaces the current history entry (instead of appending it) with this new url
|
|
175
173
|
* @param {any} [state] The history's state object, i.e., pushState (if the LocationServices implementation supports it)
|
|
176
174
|
*
|
|
177
175
|
* @return the url (after potentially being processed)
|
|
178
176
|
*/
|
|
179
|
-
url(newUrl,
|
|
180
|
-
if (isDefined(newUrl)) this.$location.
|
|
181
|
-
if (
|
|
182
|
-
|
|
183
|
-
return this.$location.url();
|
|
177
|
+
url(newUrl, state) {
|
|
178
|
+
if (isDefined(newUrl)) this.$location.setUrl(newUrl);
|
|
179
|
+
if (state) this.$location.setState(state);
|
|
180
|
+
return this.$location.getUrl();
|
|
184
181
|
}
|
|
185
182
|
|
|
186
183
|
/**
|
|
187
|
-
* @
|
|
184
|
+
* @private
|
|
188
185
|
*
|
|
189
186
|
* Registers a low level url change handler
|
|
190
187
|
*
|
|
@@ -195,8 +192,8 @@ export class UrlService {
|
|
|
195
192
|
* let deregisterFn = locationServices.onChange((evt) => console.log("url change", evt));
|
|
196
193
|
* ```
|
|
197
194
|
*
|
|
198
|
-
* @param callback a function that will be called when the url is changing
|
|
199
|
-
* @return a function that de-registers the callback
|
|
195
|
+
* @param {Function} callback a function that will be called when the url is changing
|
|
196
|
+
* @return {Function} a function that de-registers the callback
|
|
200
197
|
*/
|
|
201
198
|
onChange(callback) {
|
|
202
199
|
this._urlListeners.push(callback);
|
|
@@ -204,13 +201,21 @@ export class UrlService {
|
|
|
204
201
|
}
|
|
205
202
|
|
|
206
203
|
/**
|
|
207
|
-
* Gets the current URL parts
|
|
204
|
+
* Gets the current URL parts.
|
|
205
|
+
*
|
|
206
|
+
* Returns an object with the `path`, `search`, and `hash` components
|
|
207
|
+
* of the current browser location.
|
|
208
208
|
*
|
|
209
|
-
*
|
|
209
|
+
* @returns {import("../../services/location/interface.ts").UrlParts} The current URL's path, search, and hash.
|
|
210
210
|
*/
|
|
211
211
|
parts() {
|
|
212
|
-
return {
|
|
212
|
+
return {
|
|
213
|
+
path: this.$location.getPath(),
|
|
214
|
+
search: this.$location.getSearch(),
|
|
215
|
+
hash: this.$location.getHash(),
|
|
216
|
+
};
|
|
213
217
|
}
|
|
218
|
+
|
|
214
219
|
/**
|
|
215
220
|
* Activates the best rule for the current URL
|
|
216
221
|
*
|
|
@@ -234,16 +239,16 @@ export class UrlService {
|
|
|
234
239
|
if (evt && evt.defaultPrevented) return;
|
|
235
240
|
const stateService = this.stateService;
|
|
236
241
|
const url = {
|
|
237
|
-
path: this.
|
|
238
|
-
search: this.
|
|
239
|
-
hash: this.
|
|
242
|
+
path: this.$location.getPath(),
|
|
243
|
+
search: this.$location.getSearch(),
|
|
244
|
+
hash: this.$location.getHash(),
|
|
240
245
|
};
|
|
241
246
|
/**
|
|
242
247
|
* @type {*}
|
|
243
248
|
*/
|
|
244
249
|
const best = this.match(url);
|
|
245
250
|
const applyResult = pattern([
|
|
246
|
-
[isString, (newurl) => this.url(newurl
|
|
251
|
+
[isString, (newurl) => this.url(newurl)],
|
|
247
252
|
[
|
|
248
253
|
TargetState.isDef,
|
|
249
254
|
(def) => stateService.go(def.state, def.params, def.options),
|
|
@@ -276,7 +281,7 @@ export class UrlService {
|
|
|
276
281
|
* });
|
|
277
282
|
* ```
|
|
278
283
|
*
|
|
279
|
-
* @param enabled `true` or `false` to start or stop listening to URL changes
|
|
284
|
+
* @param {boolean} enabled `true` or `false` to start or stop listening to URL changes
|
|
280
285
|
*/
|
|
281
286
|
listen(enabled) {
|
|
282
287
|
if (enabled === false) {
|
|
@@ -354,7 +359,7 @@ export class UrlService {
|
|
|
354
359
|
* ```js
|
|
355
360
|
* matcher = $umf.compile("/about/:person");
|
|
356
361
|
* params = { person: "bob" };
|
|
357
|
-
* $bob = $
|
|
362
|
+
* $bob = $url.href(matcher, params);
|
|
358
363
|
* // $bob == "/about/bob";
|
|
359
364
|
* ```
|
|
360
365
|
*
|
|
@@ -370,22 +375,18 @@ export class UrlService {
|
|
|
370
375
|
let url = urlMatcher.format(params);
|
|
371
376
|
if (url == null) return null;
|
|
372
377
|
options = options || { absolute: false };
|
|
373
|
-
const isHtml5 = this.
|
|
374
|
-
if (!isHtml5
|
|
375
|
-
url = "#" + this.$locationProvider.
|
|
378
|
+
const isHtml5 = this.$locationProvider.html5ModeConf.enabled;
|
|
379
|
+
if (!isHtml5) {
|
|
380
|
+
url = "#" + this.$locationProvider.hashPrefixConf + url;
|
|
376
381
|
}
|
|
377
382
|
url = appendBasePath(url, isHtml5, options.absolute, this.baseHref());
|
|
378
383
|
if (!options.absolute || !url) {
|
|
379
384
|
return url;
|
|
380
385
|
}
|
|
381
386
|
const slash = !isHtml5 && url ? "/" : "";
|
|
382
|
-
const cfgPort = this.$location.port();
|
|
383
|
-
const port = cfgPort === 80 || cfgPort === 443 ? "" : ":" + cfgPort;
|
|
384
387
|
return [
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
this.$location.host(),
|
|
388
|
-
port,
|
|
388
|
+
`${window.location.protocol}//`,
|
|
389
|
+
window.location.host,
|
|
389
390
|
slash,
|
|
390
391
|
url,
|
|
391
392
|
].join("");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dealoc } from "../../shared/dom.js";
|
|
2
|
-
import { Angular } from "../../
|
|
2
|
+
import { Angular } from "../../angular.js";
|
|
3
3
|
import { map, find } from "../../shared/common.js";
|
|
4
4
|
|
|
5
5
|
describe("UrlMatcher", () => {
|
|
@@ -15,8 +15,8 @@ describe("UrlMatcher", () => {
|
|
|
15
15
|
"defaultModule",
|
|
16
16
|
]);
|
|
17
17
|
|
|
18
|
-
$injector.invoke(($
|
|
19
|
-
$url = $
|
|
18
|
+
$injector.invoke((_$url_, _$location_) => {
|
|
19
|
+
$url = _$url_;
|
|
20
20
|
$location = _$location_;
|
|
21
21
|
});
|
|
22
22
|
});
|
|
@@ -359,7 +359,7 @@ describe("UrlMatcher", () => {
|
|
|
359
359
|
expect(matcher).not.toBe(base);
|
|
360
360
|
});
|
|
361
361
|
|
|
362
|
-
it("should respect $
|
|
362
|
+
it("should respect $urlProvider.strictMode", () => {
|
|
363
363
|
let m = $url.compile("/");
|
|
364
364
|
$url.config.strictMode(false);
|
|
365
365
|
m = m.append($url.compile("foo"));
|
|
@@ -367,7 +367,7 @@ describe("UrlMatcher", () => {
|
|
|
367
367
|
expect(m.exec("/foo/")).toEqual({});
|
|
368
368
|
});
|
|
369
369
|
|
|
370
|
-
it("should respect $
|
|
370
|
+
it("should respect $urlProvider.caseInsensitive", () => {
|
|
371
371
|
let m = $url.compile("/");
|
|
372
372
|
$url.config.caseInsensitive(true);
|
|
373
373
|
m = m.append($url.compile("foo"));
|
|
@@ -375,7 +375,7 @@ describe("UrlMatcher", () => {
|
|
|
375
375
|
expect(m.exec("/FOO")).toEqual({});
|
|
376
376
|
});
|
|
377
377
|
|
|
378
|
-
it("should respect $
|
|
378
|
+
it("should respect $urlProvider.caseInsensitive when validating regex params", () => {
|
|
379
379
|
let m = $url.compile("/");
|
|
380
380
|
$url.config.caseInsensitive(true);
|
|
381
381
|
m = m.append($url.compile("foo/{param:bar}"));
|
|
@@ -441,15 +441,21 @@ describe("UrlMatcher", () => {
|
|
|
441
441
|
});
|
|
442
442
|
|
|
443
443
|
$url.url("/foo");
|
|
444
|
-
expect(m.exec($url.
|
|
444
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
445
|
+
param1: undefined,
|
|
446
|
+
});
|
|
445
447
|
$url.url("/foo?param1=bar");
|
|
446
|
-
expect(m.exec($url.
|
|
448
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
449
|
+
param1: "bar",
|
|
450
|
+
}); // auto unwrap
|
|
447
451
|
$url.url("/foo?param1=");
|
|
448
|
-
expect(m.exec($url.
|
|
452
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
453
|
+
param1: undefined,
|
|
454
|
+
});
|
|
449
455
|
$url.url("/foo?param1=bar¶m1=baz");
|
|
450
|
-
if (Array.isArray($url.
|
|
456
|
+
if (Array.isArray($url.getSearch()))
|
|
451
457
|
// conditional for angular 1.0.8
|
|
452
|
-
expect(m.exec($url.
|
|
458
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
453
459
|
param1: ["bar", "baz"],
|
|
454
460
|
});
|
|
455
461
|
|
|
@@ -485,15 +491,21 @@ describe("UrlMatcher", () => {
|
|
|
485
491
|
});
|
|
486
492
|
|
|
487
493
|
$url.url("/foo");
|
|
488
|
-
expect(m.exec($url.
|
|
494
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
495
|
+
param1: undefined,
|
|
496
|
+
});
|
|
489
497
|
$url.url("/foo?param1=");
|
|
490
|
-
expect(m.exec($url.
|
|
498
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
499
|
+
param1: undefined,
|
|
500
|
+
});
|
|
491
501
|
$url.url("/foo?param1=bar");
|
|
492
|
-
expect(m.exec($url.
|
|
502
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
503
|
+
param1: ["bar"],
|
|
504
|
+
});
|
|
493
505
|
$url.url("/foo?param1=bar¶m1=baz");
|
|
494
|
-
if (Array.isArray($url.
|
|
506
|
+
if (Array.isArray($url.getSearch()))
|
|
495
507
|
// conditional for angular 1.0.8
|
|
496
|
-
expect(m.exec($url.
|
|
508
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
497
509
|
param1: ["bar", "baz"],
|
|
498
510
|
});
|
|
499
511
|
|
|
@@ -512,16 +524,16 @@ describe("UrlMatcher", () => {
|
|
|
512
524
|
expect(m.exec("/foo")).toEqual({ "param1[]": undefined });
|
|
513
525
|
|
|
514
526
|
$url.url("/foo?param1[]=bar");
|
|
515
|
-
expect(m.exec($url.
|
|
527
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
516
528
|
"param1[]": ["bar"],
|
|
517
529
|
});
|
|
518
530
|
expect(m.format({ "param1[]": "bar" })).toBe("/foo?param1[]=bar");
|
|
519
531
|
expect(m.format({ "param1[]": ["bar"] })).toBe("/foo?param1[]=bar");
|
|
520
532
|
|
|
521
533
|
$url.url("/foo?param1[]=bar¶m1[]=baz");
|
|
522
|
-
if (Array.isArray($url.
|
|
534
|
+
if (Array.isArray($url.getSearch()))
|
|
523
535
|
// conditional for angular 1.0.8
|
|
524
|
-
expect(m.exec($url.
|
|
536
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
525
537
|
"param1[]": ["bar", "baz"],
|
|
526
538
|
});
|
|
527
539
|
expect(m.format({ "param1[]": ["bar", "baz"] })).toBe(
|
|
@@ -575,14 +587,16 @@ describe("UrlMatcher", () => {
|
|
|
575
587
|
expect(m.exec("/foo")).toEqual({ param1: undefined });
|
|
576
588
|
|
|
577
589
|
$url.url("/foo?param1=bar");
|
|
578
|
-
expect(m.exec($url.
|
|
590
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
591
|
+
param1: "bar",
|
|
592
|
+
});
|
|
579
593
|
expect(m.format({ param1: "bar" })).toBe("/foo?param1=bar");
|
|
580
594
|
expect(m.format({ param1: ["bar"] })).toBe("/foo?param1=bar");
|
|
581
595
|
|
|
582
596
|
$url.url("/foo?param1=bar¶m1=baz");
|
|
583
|
-
if (Array.isArray($url.
|
|
597
|
+
if (Array.isArray($url.getSearch()))
|
|
584
598
|
// conditional for angular 1.0.8
|
|
585
|
-
expect(m.exec($url.
|
|
599
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
586
600
|
param1: "bar,baz",
|
|
587
601
|
}); // coerced to string
|
|
588
602
|
expect(m.format({ param1: ["bar", "baz"] })).toBe(
|
|
@@ -610,7 +624,9 @@ describe("UrlMatcher", () => {
|
|
|
610
624
|
expect(m.exec("/foo/")).toEqual({ param1: undefined });
|
|
611
625
|
expect(m.exec("/foo/bar")).toEqual({ param1: ["bar"] });
|
|
612
626
|
$url.url("/foo/bar-baz");
|
|
613
|
-
expect(m.exec($location.
|
|
627
|
+
expect(m.exec($location.getUrl())).toEqual({
|
|
628
|
+
param1: ["bar", "baz"],
|
|
629
|
+
});
|
|
614
630
|
|
|
615
631
|
expect(m.format({ param1: [] })).toEqual("/foo/");
|
|
616
632
|
expect(m.format({ param1: ["bar"] })).toEqual("/foo/bar");
|
|
@@ -633,15 +649,15 @@ describe("UrlMatcher", () => {
|
|
|
633
649
|
expect(m.exec("/foo/1-2")).toEqual({ "param1[]": ["1", "2"] });
|
|
634
650
|
|
|
635
651
|
$url.url("/foo/");
|
|
636
|
-
expect(m.exec($url.
|
|
652
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
637
653
|
"param1[]": undefined,
|
|
638
654
|
});
|
|
639
655
|
$url.url("/foo/bar");
|
|
640
|
-
expect(m.exec($url.
|
|
656
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
641
657
|
"param1[]": ["bar"],
|
|
642
658
|
});
|
|
643
659
|
$url.url("/foo/bar-baz");
|
|
644
|
-
expect(m.exec($url.
|
|
660
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
645
661
|
"param1[]": ["bar", "baz"],
|
|
646
662
|
});
|
|
647
663
|
|
|
@@ -685,19 +701,19 @@ describe("UrlMatcher", () => {
|
|
|
685
701
|
|
|
686
702
|
// check that we handle $location.url decodes correctly
|
|
687
703
|
$url.url(m.format({ "param1[]": ["bar-", "-baz"] }));
|
|
688
|
-
expect(m.exec($url.
|
|
704
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
689
705
|
"param1[]": ["bar-", "-baz"],
|
|
690
706
|
});
|
|
691
707
|
|
|
692
708
|
// check that we handle $location.url decodes correctly for multiple hyphens
|
|
693
709
|
$url.url(m.format({ "param1[]": ["bar-bar-bar-", "-baz-baz-baz"] }));
|
|
694
|
-
expect(m.exec($url.
|
|
710
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
695
711
|
"param1[]": ["bar-bar-bar-", "-baz-baz-baz"],
|
|
696
712
|
});
|
|
697
713
|
|
|
698
714
|
// check that pre-encoded values are passed correctly
|
|
699
715
|
$url.url(m.format({ "param1[]": ["%2C%20%5C%2C", "-baz"] }));
|
|
700
|
-
expect(m.exec($url.
|
|
716
|
+
expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
701
717
|
"param1[]": ["%2C%20%5C%2C", "-baz"],
|
|
702
718
|
});
|
|
703
719
|
});
|
|
@@ -708,9 +724,9 @@ describe("UrlMatcher", () => {
|
|
|
708
724
|
// describe(".type()", ( ) => {
|
|
709
725
|
// let $url;
|
|
710
726
|
// beforeEach(
|
|
711
|
-
// module("ng.router.util", function ($
|
|
712
|
-
// $url = $
|
|
713
|
-
// $
|
|
727
|
+
// module("ng.router.util", function ($urlProvider) {
|
|
728
|
+
// $url = $urlProvider;
|
|
729
|
+
// $urlProvider.type("myType", {}, ( ) => {
|
|
714
730
|
// return {
|
|
715
731
|
// decode: ( ) => {
|
|
716
732
|
// return { status: "decoded" };
|
|
@@ -744,9 +760,9 @@ describe("UrlMatcher", () => {
|
|
|
744
760
|
// let $url;
|
|
745
761
|
// let $url;
|
|
746
762
|
|
|
747
|
-
// beforeEach(function ($urlMatcherFactory, $
|
|
763
|
+
// beforeEach(function ($urlMatcherFactory, $url) {
|
|
748
764
|
// $url = $urlMatcherFactory;
|
|
749
|
-
// $url = $
|
|
765
|
+
// $url = $url;
|
|
750
766
|
// });
|
|
751
767
|
|
|
752
768
|
// it("compiles patterns", ( ) => {
|
|
@@ -903,13 +919,13 @@ describe("UrlMatcher", () => {
|
|
|
903
919
|
// const m = $url.compile("/foo/{fooid:int}?{bar:int}");
|
|
904
920
|
|
|
905
921
|
// $url.url("/foo/5?bar=1");
|
|
906
|
-
// expect(m.exec($url.
|
|
922
|
+
// expect(m.exec($url.getPath(), $url.getSearch())).toEqual({ fooid: 5, bar: 1 });
|
|
907
923
|
// expect(m.format({ fooid: 5, bar: 1 })).toEqual("/foo/5?bar=1");
|
|
908
924
|
|
|
909
925
|
// $url.url("/foo/5?bar=1&bar=2&bar=3");
|
|
910
|
-
// if (Array.isArray($url.
|
|
926
|
+
// if (Array.isArray($url.getSearch()))
|
|
911
927
|
// // conditional for angular 1.0.8
|
|
912
|
-
// expect(m.exec($url.
|
|
928
|
+
// expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
913
929
|
// fooid: 5,
|
|
914
930
|
// bar: [1, 2, 3],
|
|
915
931
|
// });
|
|
@@ -937,11 +953,11 @@ describe("UrlMatcher", () => {
|
|
|
937
953
|
// });
|
|
938
954
|
|
|
939
955
|
// $url.url("/foo?bar=fox");
|
|
940
|
-
// expect(m.exec($url.
|
|
956
|
+
// expect(m.exec($url.getPath(), $url.getSearch())).toEqual({ bar: ["fox"] });
|
|
941
957
|
// expect(m.format({ bar: ["fox"] })).toEqual("/foo?bar=fox");
|
|
942
958
|
|
|
943
959
|
// $url.url("/foo?bar=quick-brown-fox");
|
|
944
|
-
// expect(m.exec($url.
|
|
960
|
+
// expect(m.exec($url.getPath(), $url.getSearch())).toEqual({
|
|
945
961
|
// bar: ["quick", "brown", "fox"],
|
|
946
962
|
// });
|
|
947
963
|
// expect(m.format({ bar: ["quick", "brown", "fox"] })).toEqual(
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/router/url/url.html";
|
|
|
5
5
|
test("unit tests contain no errors", async ({ page }) => {
|
|
6
6
|
await page.goto(TEST_URL);
|
|
7
7
|
await page.content();
|
|
8
|
+
await page.waitForTimeout(1000);
|
|
8
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
10
|
/0 failures/,
|
|
10
11
|
);
|
package/src/router/view/view.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { equals,
|
|
1
|
+
import { applyPairs, equals, find, removeFrom } from "../../shared/common.js";
|
|
2
2
|
import { curry } from "../../shared/hof.js";
|
|
3
3
|
import { trace } from "../common/trace.js";
|
|
4
4
|
import { getViewConfigFactory } from "../state/views.js";
|
|
5
|
+
|
|
5
6
|
/**
|
|
6
7
|
* The View service
|
|
7
8
|
*
|
|
@@ -26,8 +27,7 @@ export class ViewService {
|
|
|
26
27
|
this._listeners = [];
|
|
27
28
|
this._pluginapi = {
|
|
28
29
|
_registeredUIView: (id) => {
|
|
29
|
-
|
|
30
|
-
return res;
|
|
30
|
+
return find(this._ngViews, (view) => view.id === id);
|
|
31
31
|
},
|
|
32
32
|
_registeredUIViews: () => this._ngViews,
|
|
33
33
|
_activeViewConfigs: () => this._viewConfigs,
|
|
@@ -65,8 +65,7 @@ export class ViewService {
|
|
|
65
65
|
throw new Error(
|
|
66
66
|
"ViewService: No view config factory registered for type " + decl.$type,
|
|
67
67
|
);
|
|
68
|
-
|
|
69
|
-
return cfgs;
|
|
68
|
+
return cfgFactory(path, decl);
|
|
70
69
|
}
|
|
71
70
|
/**
|
|
72
71
|
* Deactivates a ViewConfig.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { dealoc } from "../../shared/dom.js";
|
|
2
|
-
import { Angular } from "../../
|
|
2
|
+
import { Angular } from "../../angular.js";
|
|
3
3
|
import { curry } from "../../shared/hof.js";
|
|
4
4
|
import { StateMatcher } from "../state/state-matcher.js";
|
|
5
5
|
import { StateBuilder } from "../state/state-builder.js";
|
|
@@ -17,7 +17,7 @@ describe("view", () => {
|
|
|
17
17
|
$injector,
|
|
18
18
|
elem = document.getElementById("app"),
|
|
19
19
|
$controllerProvider,
|
|
20
|
-
$
|
|
20
|
+
$urlProvider,
|
|
21
21
|
$view,
|
|
22
22
|
root,
|
|
23
23
|
states;
|
|
@@ -27,15 +27,13 @@ describe("view", () => {
|
|
|
27
27
|
window.angular = new Angular();
|
|
28
28
|
window.angular
|
|
29
29
|
.module("defaultModule", [])
|
|
30
|
-
.config(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
},
|
|
38
|
-
);
|
|
30
|
+
.config(function (_$provide_, _$controllerProvider_, _$urlProvider_) {
|
|
31
|
+
_$provide_.factory("foo", () => {
|
|
32
|
+
return "Foo";
|
|
33
|
+
});
|
|
34
|
+
$controllerProvider = _$controllerProvider_;
|
|
35
|
+
$urlProvider = _$urlProvider_;
|
|
36
|
+
});
|
|
39
37
|
$injector = window.angular.bootstrap(document.getElementById("app"), [
|
|
40
38
|
"defaultModule",
|
|
41
39
|
]);
|
|
@@ -46,7 +44,7 @@ describe("view", () => {
|
|
|
46
44
|
$injector = _$injector_;
|
|
47
45
|
states = {};
|
|
48
46
|
const matcher = new StateMatcher(states);
|
|
49
|
-
const stateBuilder = new StateBuilder(matcher, $
|
|
47
|
+
const stateBuilder = new StateBuilder(matcher, $urlProvider);
|
|
50
48
|
stateBuilder.builder("views", ng1ViewsBuilder);
|
|
51
49
|
register = registerState(states, stateBuilder);
|
|
52
50
|
root = register({ name: "" });
|
|
@@ -5,6 +5,7 @@ const TEST_URL = "src/router/view/view.html";
|
|
|
5
5
|
test("unit tests contain no errors", async ({ page }) => {
|
|
6
6
|
await page.goto(TEST_URL);
|
|
7
7
|
await page.content();
|
|
8
|
+
await page.waitForTimeout(1000);
|
|
8
9
|
await expect(page.locator(".jasmine-overall-result")).toHaveText(
|
|
9
10
|
/0 failures/,
|
|
10
11
|
);
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
$scope.gotoAnchor = function (x) {
|
|
24
24
|
window.$locationTest = $location;
|
|
25
25
|
const newHash = "anchor" + x;
|
|
26
|
-
if ($location.
|
|
26
|
+
if ($location.getHash() !== newHash) {
|
|
27
27
|
// set the $location.hash to `newHash` and
|
|
28
28
|
// $anchorScroll will automatically scroll to it
|
|
29
|
-
$location.
|
|
29
|
+
$location.setHash("anchor" + x);
|
|
30
30
|
} else {
|
|
31
31
|
// call $anchorScroll() explicitly,
|
|
32
32
|
// since $location.hash hasn't changed
|