@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
package/src/filters/limit-to.js
CHANGED
|
@@ -4,7 +4,6 @@ import {
|
|
|
4
4
|
isNumber,
|
|
5
5
|
isNumberNaN,
|
|
6
6
|
isString,
|
|
7
|
-
toInt,
|
|
8
7
|
} from "../shared/utils.js";
|
|
9
8
|
|
|
10
9
|
/**
|
|
@@ -23,7 +22,7 @@ export function limitToFilter() {
|
|
|
23
22
|
if (Math.abs(Number(limit)) === Infinity) {
|
|
24
23
|
limit = Number(limit);
|
|
25
24
|
} else {
|
|
26
|
-
limit =
|
|
25
|
+
limit = parseInt(/** @type {string} */ (limit), 10);
|
|
27
26
|
}
|
|
28
27
|
if (isNumberNaN(limit)) return input;
|
|
29
28
|
|
|
@@ -33,7 +32,7 @@ export function limitToFilter() {
|
|
|
33
32
|
begin =
|
|
34
33
|
!begin || isNaN(/** @type {any} */ (begin))
|
|
35
34
|
? 0
|
|
36
|
-
:
|
|
35
|
+
: parseInt(/** @type {string} */ (begin), 10);
|
|
37
36
|
begin =
|
|
38
37
|
begin < 0 ? Math.max(0, /** @type {[]} */ (input).length + begin) : begin;
|
|
39
38
|
|
package/src/index.js
CHANGED
package/src/injection-tokens.js
CHANGED
|
@@ -16,6 +16,9 @@
|
|
|
16
16
|
* @type Readonly<Record<string, string>>
|
|
17
17
|
*/
|
|
18
18
|
export const $injectTokens = Object.freeze({
|
|
19
|
+
$attrs: "$attrs",
|
|
20
|
+
$scope: "$scope",
|
|
21
|
+
$element: "$element",
|
|
19
22
|
$$AnimateRunner: "$$AnimateRunner",
|
|
20
23
|
$$animateAsyncRun: "$$animateAsyncRun",
|
|
21
24
|
$$animateCache: "$$animateCache",
|
|
@@ -44,6 +47,7 @@ export const $injectTokens = Object.freeze({
|
|
|
44
47
|
$ngViewScroll: "$ngViewScroll",
|
|
45
48
|
$parse: "$parse",
|
|
46
49
|
$rootScope: "$rootScope",
|
|
50
|
+
$rootElement: "$rootElement",
|
|
47
51
|
$routerGlobals: "$routerGlobals",
|
|
48
52
|
$sce: "$sce",
|
|
49
53
|
$sceDelegate: "$sceDelegate",
|
|
@@ -54,7 +58,7 @@ export const $injectTokens = Object.freeze({
|
|
|
54
58
|
$templateRequest: "$templateRequest",
|
|
55
59
|
$transitions: "$transitions",
|
|
56
60
|
$urlConfig: "$urlConfig",
|
|
57
|
-
$
|
|
61
|
+
$url: "$url",
|
|
58
62
|
$view: "$view",
|
|
59
63
|
// provide literals
|
|
60
64
|
$provide: "$provide",
|
package/src/interface.ts
CHANGED
|
@@ -4,6 +4,8 @@ export * from "./core/di/ng-module.js";
|
|
|
4
4
|
export * from "./services/http/interface.ts";
|
|
5
5
|
export * from "./services/log/interface.ts";
|
|
6
6
|
export * from "./services/log/log.js";
|
|
7
|
+
export * from "./services/location/interface.ts";
|
|
8
|
+
export * from "./services/location/location.js";
|
|
7
9
|
export * from "./services/pubsub/pubsub.js";
|
|
8
10
|
export * from "./services/template-cache/interface.ts";
|
|
9
11
|
export * from "./services/template-cache/template-cache.js";
|
|
@@ -66,7 +68,7 @@ export interface Provider {
|
|
|
66
68
|
/**
|
|
67
69
|
* Register a directive
|
|
68
70
|
* @param name - The name of the directive.
|
|
69
|
-
* @param
|
|
71
|
+
* @param directive - An object with a `$get` property that defines how the service is created.
|
|
70
72
|
*/
|
|
71
73
|
directive(name: string, directive: DirectiveFactory): Provider;
|
|
72
74
|
|
package/src/loader.md
CHANGED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/\*\*
|
|
2
|
-
|
|
3
|
-
- @ngdoc module
|
|
4
|
-
- @name ng
|
|
5
|
-
|
|
6
|
-
- @installation
|
|
7
|
-
- @description
|
|
8
|
-
-
|
|
9
|
-
- The ng module is loaded by default when an AngularTS application is started. The module itself
|
|
10
|
-
- contains the essential components for an AngularTS application to function. The table below
|
|
11
|
-
- lists a high level breakdown of each of the services/factories, filters, directives and testing
|
|
12
|
-
- components available within this core module.
|
|
13
|
-
- \*/
|
|
14
|
-
|
|
15
|
-
/\*\*
|
|
16
|
-
|
|
17
|
-
- @ngdoc directive
|
|
18
|
-
- @name ngApp
|
|
19
|
-
-
|
|
20
|
-
- @element ANY
|
|
21
|
-
- @param {import('./interface.ts').Module} ngApp an optional application
|
|
22
|
-
- {@link angular.module module} name to load.
|
|
23
|
-
- @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be
|
|
24
|
-
- created in "strict-di" mode. This means that the application will fail to invoke functions which
|
|
25
|
-
- do not use explicit function annotation (and are thus unsuitable for minification), as described
|
|
26
|
-
- in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in
|
|
27
|
-
- tracking down the root of these bugs.
|
|
28
|
-
-
|
|
29
|
-
- @description
|
|
30
|
-
-
|
|
31
|
-
- Use this directive to **auto-bootstrap** an AngularTS application. The `ngApp` directive
|
|
32
|
-
- designates the **root element** of the application and is typically placed near the root element
|
|
33
|
-
- of the page - e.g. on the `<body>` or `<html>` tags.
|
|
34
|
-
-
|
|
35
|
-
- There are a few things to keep in mind when using `ngApp`:
|
|
36
|
-
- - only one AngularTS application can be auto-bootstrapped per HTML document. The first `ngApp`
|
|
37
|
-
- found in the document will be used to define the root element to auto-bootstrap as an
|
|
38
|
-
- application. To run multiple applications in an HTML document you must manually bootstrap them using
|
|
39
|
-
- {@link angular.bootstrap} instead.
|
|
40
|
-
- - AngularTS applications cannot be nested within each other.
|
|
41
|
-
- - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`.
|
|
42
|
-
- This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and
|
|
43
|
-
- {@link ngRoute.ngView `ngView`}.
|
|
44
|
-
- Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},
|
|
45
|
-
- causing animations to stop working and making the injector inaccessible from outside the app.
|
|
46
|
-
-
|
|
47
|
-
- You can specify an **AngularTS module** to be used as the root module for the application. This
|
|
48
|
-
- module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It
|
|
49
|
-
- should contain the application code needed or have dependencies on other modules that will
|
|
50
|
-
- contain the code. See {@link angular.module} for more information.
|
|
51
|
-
-
|
|
52
|
-
- In the example below if the `ngApp` directive were not placed on the `html` element then the
|
|
53
|
-
- document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
|
|
54
|
-
- would not be resolved to `3`.
|
|
55
|
-
-
|
|
56
|
-
- @example
|
|
57
|
-
-
|
|
58
|
-
- ### Simple Usage
|
|
59
|
-
-
|
|
60
|
-
- `ngApp` is the easiest, and most common way to bootstrap an application.
|
|
61
|
-
- <example module="ngAppDemo" name="ng-app">
|
|
62
|
-
<file name="index.html">
|
|
63
|
-
<div ng-controller="ngAppDemoController">
|
|
64
|
-
I can add: {{a}} + {{b}} = {{ a+b }}
|
|
65
|
-
</div>
|
|
66
|
-
</file>
|
|
67
|
-
<file name="script.js">
|
|
68
|
-
angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
|
|
69
|
-
$scope.a = 1;
|
|
70
|
-
$scope.b = 2;
|
|
71
|
-
});
|
|
72
|
-
</file>
|
|
73
|
-
</example>
|
|
74
|
-
-
|
|
75
|
-
- @example
|
|
76
|
-
-
|
|
77
|
-
- ### With `ngStrictDi`
|
|
78
|
-
-
|
|
79
|
-
- Using `ngStrictDi`, you would see something like this:
|
|
80
|
-
- <example ng-app-included="true" name="strict-di">
|
|
81
|
-
<file name="index.html">
|
|
82
|
-
<div ng-app="ngAppStrictDemo" ng-strict-di>
|
|
83
|
-
<div ng-controller="GoodController1">
|
|
84
|
-
I can add: {{a}} + {{b}} = {{ a+b }}
|
|
85
|
-
|
|
86
|
-
<p>This renders because the controller does not fail to
|
|
87
|
-
instantiate, by using explicit annotation style (see
|
|
88
|
-
script.js for details)
|
|
89
|
-
</p>
|
|
90
|
-
</div>
|
|
91
|
-
|
|
92
|
-
<div ng-controller="GoodController2">
|
|
93
|
-
Name: <input ng-model="name"><br />
|
|
94
|
-
Hello, {{name}}!
|
|
95
|
-
|
|
96
|
-
<p>This renders because the controller does not fail to
|
|
97
|
-
instantiate, by using explicit annotation style
|
|
98
|
-
(see script.js for details)
|
|
99
|
-
</p>
|
|
100
|
-
</div>
|
|
101
|
-
|
|
102
|
-
<div ng-controller="BadController">
|
|
103
|
-
I can add: {{a}} + {{b}} = {{ a+b }}
|
|
104
|
-
|
|
105
|
-
<p>The controller could not be instantiated, due to relying
|
|
106
|
-
on automatic function annotations (which are disabled in
|
|
107
|
-
strict mode). As such, the content of this section is not
|
|
108
|
-
interpolated, and there should be an error in your web console.
|
|
109
|
-
</p>
|
|
110
|
-
</div>
|
|
111
|
-
|
|
112
|
-
</div>
|
|
113
|
-
</file>
|
|
114
|
-
<file name="script.js">
|
|
115
|
-
angular.module('ngAppStrictDemo', [])
|
|
116
|
-
// BadController will fail to instantiate, due to relying on automatic function annotation,
|
|
117
|
-
// rather than an explicit annotation
|
|
118
|
-
.controller('BadController', function($scope) {
|
|
119
|
-
$scope.a = 1;
|
|
120
|
-
$scope.b = 2;
|
|
121
|
-
})
|
|
122
|
-
// Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,
|
|
123
|
-
// due to using explicit annotations using the array style and $inject property, respectively.
|
|
124
|
-
.controller('GoodController1', ['$scope', function($scope) {
|
|
125
|
-
$scope.a = 1;
|
|
126
|
-
$scope.b = 2;
|
|
127
|
-
}])
|
|
128
|
-
.controller('GoodController2', GoodController2);
|
|
129
|
-
function GoodController2($scope) {
|
|
130
|
-
$scope.name = 'World';
|
|
131
|
-
}
|
|
132
|
-
GoodController2.$inject = ['$scope'];
|
|
133
|
-
</file>
|
|
134
|
-
<file name="style.css">
|
|
135
|
-
div[ng-controller] {
|
|
136
|
-
margin-bottom: 1em;
|
|
137
|
-
-webkit-border-radius: 4px;
|
|
138
|
-
border-radius: 4px;
|
|
139
|
-
border: 1px solid;
|
|
140
|
-
padding: .5em;
|
|
141
|
-
}
|
|
142
|
-
div[ng-controller^=Good] {
|
|
143
|
-
border-color: #d6e9c6;
|
|
144
|
-
background-color: #dff0d8;
|
|
145
|
-
color: #3c763d;
|
|
146
|
-
}
|
|
147
|
-
div[ng-controller^=Bad] {
|
|
148
|
-
border-color: #ebccd1;
|
|
149
|
-
background-color: #f2dede;
|
|
150
|
-
color: #a94442;
|
|
151
|
-
margin-bottom: 0;
|
|
152
|
-
}
|
|
153
|
-
</file>
|
|
154
|
-
</example>
|
|
155
|
-
*/
|
package/src/{public.js → ng.js}
RENAMED
|
@@ -132,10 +132,11 @@ import {
|
|
|
132
132
|
ngPostDirective,
|
|
133
133
|
ngPutDirective,
|
|
134
134
|
} from "./directive/http/http.js";
|
|
135
|
+
import { $injectTokens as $t } from "./injection-tokens.js";
|
|
135
136
|
|
|
136
137
|
/**
|
|
137
138
|
* Initializes core `ng` module.
|
|
138
|
-
* @param {import('./
|
|
139
|
+
* @param {import('./angular.js').Angular} angular
|
|
139
140
|
* @returns {import('./core/di/ng-module.js').NgModule} `ng` module
|
|
140
141
|
*/
|
|
141
142
|
export function registerNgModule(angular) {
|
|
@@ -144,7 +145,7 @@ export function registerNgModule(angular) {
|
|
|
144
145
|
"ng",
|
|
145
146
|
[],
|
|
146
147
|
[
|
|
147
|
-
|
|
148
|
+
$t.$provide,
|
|
148
149
|
/** @param {import("./interface.js").Provider} $provide */
|
|
149
150
|
($provide) => {
|
|
150
151
|
// $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
|
|
@@ -152,7 +153,7 @@ export function registerNgModule(angular) {
|
|
|
152
153
|
$$sanitizeUri: SanitizeUriProvider,
|
|
153
154
|
});
|
|
154
155
|
$provide
|
|
155
|
-
.provider(
|
|
156
|
+
.provider($t.$compile, CompileProvider)
|
|
156
157
|
.directive({
|
|
157
158
|
input: inputDirective,
|
|
158
159
|
textarea: inputDirective,
|
|
@@ -269,7 +270,7 @@ export function registerNgModule(angular) {
|
|
|
269
270
|
$state: StateProvider,
|
|
270
271
|
$ngViewScroll: ViewScrollProvider,
|
|
271
272
|
$templateFactory: TemplateFactoryProvider,
|
|
272
|
-
$
|
|
273
|
+
$url: UrlService,
|
|
273
274
|
$stateRegistry: StateRegistryProvider,
|
|
274
275
|
$eventBus: PubSubProvider,
|
|
275
276
|
});
|
|
@@ -277,14 +278,12 @@ export function registerNgModule(angular) {
|
|
|
277
278
|
],
|
|
278
279
|
)
|
|
279
280
|
.factory("$stateParams", [
|
|
280
|
-
|
|
281
|
+
$t.$routerGlobals,
|
|
281
282
|
/**
|
|
282
283
|
* @param {import('./router/globals.js').RouterGlobals} globals
|
|
283
284
|
* @returns {import('./router/params/state-params.js').StateParams }
|
|
284
285
|
*/
|
|
285
|
-
|
|
286
|
-
return globals.params;
|
|
287
|
-
},
|
|
286
|
+
(globals) => globals.params,
|
|
288
287
|
])
|
|
289
288
|
.value("$trace", trace);
|
|
290
289
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Angular } from "../../
|
|
1
|
+
import { Angular } from "../../angular.js";
|
|
2
2
|
import { createElementFromHTML, dealoc } from "../../shared/dom.js";
|
|
3
3
|
import { browserTrigger, wait } from "../../shared/test-utils.js";
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@ describe("ngStateRef", () => {
|
|
|
15
15
|
$injector,
|
|
16
16
|
$state,
|
|
17
17
|
$stateParams,
|
|
18
|
-
$
|
|
18
|
+
$url;
|
|
19
19
|
|
|
20
20
|
beforeEach(() => {
|
|
21
21
|
dealoc(document.getElementById("app"));
|
|
@@ -30,7 +30,8 @@ describe("ngStateRef", () => {
|
|
|
30
30
|
*/
|
|
31
31
|
($stateProvider, $locationProvider) => {
|
|
32
32
|
_locationProvider = $locationProvider;
|
|
33
|
-
$locationProvider.
|
|
33
|
+
$locationProvider.html5ModeConf.enabled = false;
|
|
34
|
+
$locationProvider.hashPrefixConf = "";
|
|
34
35
|
$stateProvider
|
|
35
36
|
.state({ name: "top", url: "" })
|
|
36
37
|
.state({ name: "other", url: "/other/:id", template: "other" })
|
|
@@ -60,9 +61,9 @@ describe("ngStateRef", () => {
|
|
|
60
61
|
$rootScope = $injector.get("$rootScope");
|
|
61
62
|
$compile = $injector.get("$compile");
|
|
62
63
|
$state = $injector.get("$state");
|
|
63
|
-
$stateParams = $injector.get("$
|
|
64
|
-
$
|
|
65
|
-
$
|
|
64
|
+
$stateParams = $injector.get("$routerGlobals").params;
|
|
65
|
+
$url = $injector.get("$url");
|
|
66
|
+
$url.listen();
|
|
66
67
|
});
|
|
67
68
|
|
|
68
69
|
afterEach(() => (window.location.hash = ""));
|
|
@@ -704,7 +705,7 @@ describe("ngSrefActive", () => {
|
|
|
704
705
|
$rootScope = $injector.get("$rootScope");
|
|
705
706
|
$compile = $injector.get("$compile");
|
|
706
707
|
$state = $injector.get("$state");
|
|
707
|
-
$stateParams = $injector.get("$
|
|
708
|
+
$stateParams = $injector.get("$routerGlobals").params;
|
|
708
709
|
});
|
|
709
710
|
|
|
710
711
|
it("should update class for sibling ngSref", async () => {
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { filter, tail, unnestR } from "../../shared/common.js";
|
|
2
|
-
import {
|
|
3
|
-
hasAnimate,
|
|
4
|
-
isDefined,
|
|
5
|
-
isFunction,
|
|
6
|
-
// isString,
|
|
7
|
-
} from "../../shared/utils.js";
|
|
2
|
+
import { hasAnimate, isDefined, isFunction } from "../../shared/utils.js";
|
|
8
3
|
// import { kebobString } from "../../shared/strings.js";
|
|
9
4
|
import { parse } from "../../shared/hof.js";
|
|
10
5
|
import { ResolveContext } from "../resolve/resolve-context.js";
|
|
@@ -283,7 +278,7 @@ export let ngView = [
|
|
|
283
278
|
* @param {string} viewName Name of the view.
|
|
284
279
|
*/
|
|
285
280
|
newScope.$emit("$viewContentLoading", name);
|
|
286
|
-
|
|
281
|
+
currentEl = $transclude(newScope, function (clone) {
|
|
287
282
|
setCacheData(clone, "$ngViewAnim", $ngViewAnim);
|
|
288
283
|
setCacheData(clone, "$ngView", $ngViewData);
|
|
289
284
|
renderer.enter(clone, $element, function () {
|
|
@@ -299,7 +294,6 @@ export let ngView = [
|
|
|
299
294
|
});
|
|
300
295
|
cleanupLastView();
|
|
301
296
|
});
|
|
302
|
-
currentEl = cloned;
|
|
303
297
|
currentScope = newScope;
|
|
304
298
|
/**
|
|
305
299
|
* Fired once the view is **loaded**, *after* the DOM is rendered.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createElementFromHTML, dealoc } from "../../shared/dom.js";
|
|
2
|
-
import { Angular } from "../../
|
|
2
|
+
import { Angular } from "../../angular.js";
|
|
3
3
|
import { wait } from "../../shared/test-utils.js";
|
|
4
4
|
|
|
5
5
|
describe("ngView", () => {
|
|
@@ -852,7 +852,7 @@ describe("ngView named", () => {
|
|
|
852
852
|
|
|
853
853
|
// Test for https://github.com/angular-ui/ui-router/issues/3355
|
|
854
854
|
xit("should target weird nested view setups using the view's simple name", async () => {
|
|
855
|
-
|
|
855
|
+
elem.innerHTML = `
|
|
856
856
|
<div>
|
|
857
857
|
<div ng-view="main">
|
|
858
858
|
MAIN-DEFAULT-
|
|
@@ -862,7 +862,6 @@ describe("ngView named", () => {
|
|
|
862
862
|
</div>
|
|
863
863
|
</div>
|
|
864
864
|
`;
|
|
865
|
-
elem.innerHTML = tpl;
|
|
866
865
|
$compile(elem)($rootScope);
|
|
867
866
|
|
|
868
867
|
$state.go("test");
|
|
@@ -1833,9 +1832,9 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1833
1832
|
name: "ng12-dynamic-directive",
|
|
1834
1833
|
url: "/ng12dynamicDirective/:type",
|
|
1835
1834
|
componentProvider: [
|
|
1836
|
-
"$
|
|
1837
|
-
function ($
|
|
1838
|
-
return $
|
|
1835
|
+
"$routerGlobals",
|
|
1836
|
+
function ($routerGlobals) {
|
|
1837
|
+
return $routerGlobals.params.type;
|
|
1839
1838
|
},
|
|
1840
1839
|
],
|
|
1841
1840
|
});
|
|
@@ -1861,9 +1860,9 @@ describe("angular 1.5+ style .component()", () => {
|
|
|
1861
1860
|
name: "dynamicComponent",
|
|
1862
1861
|
url: "/dynamicComponent/:type",
|
|
1863
1862
|
componentProvider: [
|
|
1864
|
-
"$
|
|
1865
|
-
function ($
|
|
1866
|
-
return $
|
|
1863
|
+
"$routerGlobals",
|
|
1864
|
+
function ($routerGlobals) {
|
|
1865
|
+
return $routerGlobals.params.type;
|
|
1867
1866
|
},
|
|
1868
1867
|
],
|
|
1869
1868
|
});
|
|
@@ -6,13 +6,12 @@
|
|
|
6
6
|
|
|
7
7
|
<link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
|
|
8
8
|
<link rel="stylesheet" href="/jasmine/jasmine.css" />
|
|
9
|
-
<link rel="stylesheet" href="/
|
|
9
|
+
<link rel="stylesheet" href="/jasmine-helper.css" />
|
|
10
10
|
<script src="/jasmine/jasmine.js"></script>
|
|
11
11
|
<script src="/jasmine/jasmine-html.js"></script>
|
|
12
12
|
<script src="/jasmine/boot0.js"></script>
|
|
13
13
|
<script src="/jasmine/boot1.js"></script>
|
|
14
|
-
<script type="module" src="/src/router/
|
|
15
|
-
<script type="module" src="/src/router/common/queue.spec.js"></script>
|
|
14
|
+
<script type="module" src="/src/router/glob/glob.spec.js"></script>
|
|
16
15
|
</head>
|
|
17
16
|
<body>
|
|
18
17
|
<div id="app"></div>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { test, expect } from "@playwright/test";
|
|
2
2
|
|
|
3
|
-
const TEST_URL = "src/router/
|
|
3
|
+
const TEST_URL = "src/router/glob/glob.html";
|
|
4
4
|
|
|
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/globals.js
CHANGED
|
@@ -89,8 +89,13 @@ export class PathUtils {
|
|
|
89
89
|
// The param keys specified by the incoming toParams
|
|
90
90
|
return toPath.map(makeInheritedParamsNode);
|
|
91
91
|
}
|
|
92
|
+
|
|
92
93
|
/**
|
|
93
94
|
* Computes the tree changes (entering, exiting) between a fromPath and toPath.
|
|
95
|
+
* @param {PathNode[]} fromPath
|
|
96
|
+
* @param {PathNode[]} toPath
|
|
97
|
+
* @param {boolean} [reloadState]
|
|
98
|
+
* @returns {import("../transition/interface.js").TreeChanges}
|
|
94
99
|
*/
|
|
95
100
|
static treeChanges(fromPath, toPath, reloadState) {
|
|
96
101
|
const max = Math.min(fromPath.length, toPath.length);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>AngularTS</title>
|
|
6
|
+
<link rel="shortcut icon" type="image/png" href="images/favicon.ico" />
|
|
7
|
+
<script type="module" src="../index.js"></script>
|
|
8
|
+
<script>
|
|
9
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
10
|
+
window.angular.module("router", []).config([
|
|
11
|
+
"$stateProvider",
|
|
12
|
+
"$locationProvider",
|
|
13
|
+
($stateProvider, $locationProvider) => {
|
|
14
|
+
$locationProvider.html5ModeConf = {
|
|
15
|
+
enabled: false,
|
|
16
|
+
};
|
|
17
|
+
$stateProvider
|
|
18
|
+
.state({
|
|
19
|
+
name: "home",
|
|
20
|
+
url: "",
|
|
21
|
+
template: `
|
|
22
|
+
<h1>Home</h1>
|
|
23
|
+
<a ng-sref="page1">Page 1</a>
|
|
24
|
+
<a ng-sref="page2">Page 2</a>
|
|
25
|
+
`,
|
|
26
|
+
})
|
|
27
|
+
.state({
|
|
28
|
+
name: "page1",
|
|
29
|
+
url: "/page1",
|
|
30
|
+
template: "<h3>Its the NG-Router hello world app!</h3>",
|
|
31
|
+
})
|
|
32
|
+
.state({
|
|
33
|
+
name: "page2",
|
|
34
|
+
url: "/page2",
|
|
35
|
+
template: "This is another template",
|
|
36
|
+
});
|
|
37
|
+
},
|
|
38
|
+
]);
|
|
39
|
+
});
|
|
40
|
+
</script>
|
|
41
|
+
</head>
|
|
42
|
+
<body ng-app="router">
|
|
43
|
+
<ng-view></ng-view>
|
|
44
|
+
</body>
|
|
45
|
+
</html>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Angular } from "../
|
|
1
|
+
import { Angular } from "../angular.js";
|
|
2
2
|
import { dealoc } from "../shared/dom.js";
|
|
3
3
|
|
|
4
4
|
describe("router services", () => {
|
|
@@ -11,14 +11,14 @@ describe("router services", () => {
|
|
|
11
11
|
let module = window["angular"].module("defaultModule", []);
|
|
12
12
|
module.config(
|
|
13
13
|
(
|
|
14
|
-
$
|
|
14
|
+
$urlProvider,
|
|
15
15
|
$stateRegistryProvider,
|
|
16
16
|
$routerGlobalsProvider,
|
|
17
17
|
$transitionsProvider,
|
|
18
18
|
$stateProvider,
|
|
19
19
|
) => {
|
|
20
20
|
providers = {
|
|
21
|
-
$
|
|
21
|
+
$urlProvider,
|
|
22
22
|
$stateRegistryProvider,
|
|
23
23
|
$routerGlobalsProvider,
|
|
24
24
|
$transitionsProvider,
|
|
@@ -33,7 +33,7 @@ describe("router services", () => {
|
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
it("Should expose ng-router providers from the UIRouter instance", () => {
|
|
36
|
-
expect(providers.$
|
|
36
|
+
expect(providers.$urlProvider).toBeDefined();
|
|
37
37
|
expect(providers.$stateRegistryProvider).toBeDefined();
|
|
38
38
|
expect(providers.$stateRegistryProvider).toBeDefined();
|
|
39
39
|
expect(providers.$transitionsProvider).toBeDefined();
|
|
@@ -41,12 +41,11 @@ describe("router services", () => {
|
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
it("Should expose ng-router services from the UIRouter instance", () => {
|
|
44
|
-
expect($injector.get("$
|
|
44
|
+
expect($injector.get("$url")).toBeDefined();
|
|
45
45
|
expect($injector.get("$stateRegistry")).toBeDefined();
|
|
46
46
|
expect($injector.get("$routerGlobals")).toBeDefined();
|
|
47
47
|
expect($injector.get("$transitions")).toBeDefined();
|
|
48
48
|
expect($injector.get("$state")).toBeDefined();
|
|
49
|
-
expect($injector.get("$stateParams")).toBeDefined();
|
|
50
49
|
expect($injector.get("$view")).toBeDefined();
|
|
51
50
|
expect($injector.get("$trace")).toBeDefined();
|
|
52
51
|
});
|
|
@@ -607,7 +607,7 @@ export interface StateDeclaration {
|
|
|
607
607
|
*
|
|
608
608
|
* An optional object which defines multiple views, or explicitly targets specific named ui-views.
|
|
609
609
|
*
|
|
610
|
-
* - What is a view
|
|
610
|
+
* - What is a view urlConfig
|
|
611
611
|
* - What is a ui-view
|
|
612
612
|
* - Shorthand controller/template
|
|
613
613
|
* - Incompatible with ^
|
|
@@ -30,7 +30,7 @@ function dataBuilder(state) {
|
|
|
30
30
|
return state.data;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
function getUrlBuilder($
|
|
33
|
+
function getUrlBuilder($url, root) {
|
|
34
34
|
return function (stateObject) {
|
|
35
35
|
let stateDec = stateObject.self;
|
|
36
36
|
// For future states, i.e., states whose name ends with `.**`,
|
|
@@ -50,9 +50,9 @@ function getUrlBuilder($urlService, root) {
|
|
|
50
50
|
const parsed = parseUrl(stateDec.url);
|
|
51
51
|
const url = !parsed
|
|
52
52
|
? stateDec.url
|
|
53
|
-
: $
|
|
53
|
+
: $url.compile(parsed.val, { state: stateDec });
|
|
54
54
|
if (!url) return null;
|
|
55
|
-
if (!$
|
|
55
|
+
if (!$url.isMatcher(url))
|
|
56
56
|
throw new Error(`Invalid url '${url}' in state '${stateObject}'`);
|
|
57
57
|
return parsed && parsed.root
|
|
58
58
|
? url
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defaults, find } from "../../shared/common.js";
|
|
2
2
|
import { propEq } from "../../shared/hof.js";
|
|
3
|
-
import { Glob } from "../
|
|
3
|
+
import { Glob } from "../glob/glob.js";
|
|
4
4
|
import { hasOwn, isFunction, isObject } from "../../shared/utils.js";
|
|
5
5
|
|
|
6
6
|
/** @typedef {import('./interface.js').StateDeclaration} StateDeclaration */
|
|
@@ -16,8 +16,8 @@ import { $injectTokens, provider } from "../../injection-tokens.js";
|
|
|
16
16
|
*
|
|
17
17
|
*/
|
|
18
18
|
export class StateRegistryProvider {
|
|
19
|
-
static $inject = provider([
|
|
20
|
-
$injectTokens.$
|
|
19
|
+
/* @ignore */ static $inject = provider([
|
|
20
|
+
$injectTokens.$url,
|
|
21
21
|
$injectTokens.$state,
|
|
22
22
|
$injectTokens.$routerGlobals,
|
|
23
23
|
$injectTokens.$view,
|