@angular-wave/angular.ts 0.7.7 → 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/animations/raf-scheduler.d.ts +2 -2
- package/@types/animations/shared.d.ts +0 -1
- package/@types/core/compile/attributes.d.ts +3 -3
- package/@types/core/compile/compile.d.ts +1 -1
- package/@types/core/di/injector.d.ts +0 -1
- package/@types/core/di/internal-injector.d.ts +1 -0
- package/@types/core/di/ng-module.d.ts +5 -0
- package/@types/core/filter/filter.d.ts +11 -13
- package/@types/core/parse/parse.d.ts +6 -7
- package/@types/core/sanitize/sanitize-uri.d.ts +3 -6
- package/@types/core/scope/scope.d.ts +1 -1
- package/@types/directive/attrs/attrs.d.ts +7 -1
- package/@types/directive/bind/bind.d.ts +2 -1
- package/@types/directive/events/events.d.ts +9 -3
- package/@types/directive/http/http.d.ts +6 -2
- package/@types/directive/include/include.d.ts +2 -2
- package/@types/directive/input/input.d.ts +2 -12
- package/@types/directive/messages/messages.d.ts +9 -48
- package/@types/directive/model/model.d.ts +3 -3
- package/@types/directive/options/options.d.ts +13 -20
- package/@types/directive/switch/switch.d.ts +1 -0
- package/@types/directive/transclude/transclude.d.ts +10 -6
- package/@types/index.d.ts +1 -1
- package/@types/interface.d.ts +56 -18
- package/@types/{public.d.ts → ng.d.ts} +2 -2
- package/@types/router/directives/view-directive.d.ts +2 -19
- package/@types/router/{common → glob}/glob.d.ts +5 -1
- package/@types/router/globals.d.ts +2 -3
- 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-registry.d.ts +1 -2
- 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 +30 -42
- package/@types/services/anchor-scroll.d.ts +1 -1
- package/@types/{core → services/exception}/exception-handler.d.ts +4 -4
- package/@types/{core/error-handler.d.ts → services/exception/interface.d.ts} +1 -1
- package/@types/services/http/http.d.ts +48 -3
- package/@types/services/http/interface.d.ts +2 -2
- package/@types/services/http-backend/http-backend.d.ts +49 -44
- package/@types/services/location/interface.d.ts +63 -0
- package/@types/services/location/location.d.ts +330 -0
- package/@types/{core → services}/sce/sce.d.ts +1 -1
- package/@types/services/template-cache/interface.d.ts +8 -2
- package/@types/services/template-cache/template-cache.d.ts +1 -1
- package/@types/services/template-request.d.ts +1 -1
- package/@types/shared/cache.d.ts +0 -2
- package/@types/shared/common.d.ts +0 -2
- package/@types/shared/dom.d.ts +6 -0
- package/@types/shared/interface.d.ts +0 -4
- package/@types/{router/common → shared}/queue.d.ts +2 -2
- package/@types/shared/test-utils.d.ts +1 -0
- package/@types/shared/url-utils/interface.d.ts +46 -0
- package/@types/shared/url-utils/url-utils.d.ts +64 -0
- package/@types/shared/utils.d.ts +44 -6
- package/Makefile +8 -4
- package/dist/angular-ts.esm.js +1889 -2199
- package/dist/angular-ts.umd.js +1889 -2199
- 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 +10 -8
- 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 +203 -0
- 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 +66 -1
- package/docs/content/docs/service/location.md +57 -0
- package/docs/content/docs/service/templateCache.md +2 -2
- package/docs/content/docs/service/url.md +5 -0
- package/docs/layouts/partials/hooks/head-end.html +1 -1
- package/docs/layouts/shortcodes/showcss.html +2 -0
- 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-bind/ng-bind.html +2 -2
- 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/hierarchy.js +1 -1
- 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/classes/NgModule.html +32 -0
- package/docs/static/typedoc/classes/TemplateCacheProvider.html +1 -1
- package/docs/static/typedoc/hierarchy.html +1 -1
- package/docs/static/typedoc/index.html +1 -1
- package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
- package/docs/static/typedoc/interfaces/Directive.html +5 -4
- package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
- package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +1 -1
- package/docs/static/typedoc/interfaces/HttpResponse.html +2 -3
- package/docs/static/typedoc/interfaces/Provider.html +16 -10
- package/docs/static/typedoc/interfaces/RequestConfig.html +1 -1
- package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +1 -1
- package/docs/static/typedoc/interfaces/TemplateCache.html +7 -0
- package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
- package/docs/static/typedoc/types/AnnotatedDirectiveFactory.html +1 -0
- package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
- package/docs/static/typedoc/types/DirectiveFactory.html +1 -2
- package/docs/static/typedoc/types/DirectiveFactoryFn.html +1 -0
- package/docs/static/typedoc/types/Expression.html +1 -1
- package/docs/static/typedoc/types/HttpResponseStatus.html +1 -0
- package/docs/static/typedoc/types/{TemplateCache.html → SwapModeType.html} +1 -1
- package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
- package/docs/static/typedoc/variables/SwapMode.html +11 -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/legacy.d.ts +0 -10
- package/package.json +1 -3
- package/src/{loader.js → angular.js} +5 -10
- package/src/angular.spec.js +189 -21
- package/src/animations/animate-children-directive.js +2 -2
- package/src/animations/animate-css.js +17 -18
- package/src/animations/animate.spec.js +1 -1
- package/src/animations/raf-scheduler.js +1 -1
- package/src/animations/shared.js +2 -12
- package/src/binding.spec.js +1 -1
- package/src/core/compile/attributes.js +1 -1
- package/src/core/compile/compile.js +7 -10
- 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 +11 -25
- 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 +7 -7
- package/src/core/di/ng-module.js +12 -27
- package/src/core/filter/filter.js +28 -28
- 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/interpreter.js +32 -38
- 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/sanitize/sanitize-uri.js +3 -3
- package/src/core/scope/scope.js +12 -13
- 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.js +7 -4
- 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.js +6 -2
- 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 +3 -1
- package/src/directive/http/form-test.html +18 -0
- package/src/directive/http/get.spec.js +281 -4
- package/src/directive/http/http.js +112 -15
- package/src/directive/http/http.test.js +2 -2
- package/src/directive/http/post.spec.js +506 -9
- package/src/directive/http/put.spec.js +3 -1
- package/src/directive/if/if.spec.js +1 -1
- package/src/directive/include/include.js +7 -7
- 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 +19 -43
- package/src/directive/input/input.spec.js +1 -2
- package/src/directive/input/input.test.js +1 -0
- package/src/directive/messages/messages.js +4 -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 +14 -14
- 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.js +454 -464
- 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.js +12 -14
- package/src/directive/setter/setter.spec.js +40 -17
- 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.js +1 -0
- package/src/directive/switch/switch.spec.js +1 -1
- package/src/directive/switch/switch.test.js +1 -0
- package/src/directive/transclude/transclude.js +87 -89
- 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 +6 -2
- package/src/interface.ts +70 -19
- package/src/loader.md +0 -155
- package/src/{public.js → ng.js} +16 -23
- package/src/{public.spec.js → ng.spec.js} +1 -1
- package/src/router/directives/state-directives.spec.js +9 -8
- package/src/router/directives/view-directive.js +11 -9
- 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 → glob}/glob.js +5 -0
- package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
- package/src/router/globals.js +1 -2
- 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 -3
- 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 +15 -11
- 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 +82 -85
- 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 -9
- package/src/services/anchor-scroll.js +6 -5
- package/src/{core → services/exception}/exception-handler.js +2 -2
- package/src/{core/error-handler.ts → services/exception/interface.ts} +1 -1
- package/src/services/http/http.js +11 -17
- package/src/services/http/http.spec.js +2 -7
- package/src/services/http/interface.ts +2 -2
- package/src/services/http/template-request.spec.js +1 -1
- package/src/services/http-backend/http-backend.js +53 -89
- package/src/services/http-backend/http-backend.spec.js +2 -6
- package/src/services/http-backend/http-backend.test.js +1 -0
- package/src/services/location/interface.ts +70 -0
- package/src/{core → services}/location/location.html +4 -1
- package/src/services/location/location.js +999 -0
- package/src/{core → services}/location/location.spec.js +911 -532
- package/src/{core → 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/{core → services}/sce/sce.html +1 -1
- package/src/{core → services}/sce/sce.js +14 -10
- package/src/{core → services}/sce/sce.md +2 -2
- package/src/{core → services}/sce/sce.spec.js +3 -4
- package/src/{core → services}/sce/sce.test.js +1 -1
- package/src/services/template-cache/interface.ts +8 -2
- package/src/services/template-cache/template-cache.js +3 -1
- package/src/services/template-cache/template-cache.spec.js +73 -1
- package/src/services/template-cache/template-cache.test.js +1 -0
- package/src/services/template-request.js +2 -1
- package/src/shared/cache.js +0 -2
- package/src/shared/common.js +0 -5
- package/src/shared/common.spec.js +1 -1
- package/src/shared/dom.js +10 -0
- 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/test-utils.js +1 -0
- package/src/shared/url-utils/interface.ts +54 -0
- package/src/{core → shared}/url-utils/url-utils.html +4 -1
- package/src/{core → shared}/url-utils/url-utils.js +26 -47
- package/src/{core → shared}/url-utils/url-utils.spec.js +10 -17
- package/src/{core → shared}/url-utils/url-utils.test.js +1 -1
- package/src/shared/utils.js +60 -9
- package/src/shared/utils.spec.js +35 -1
- package/src/src.html +1 -2
- package/typedoc.json +0 -1
- package/utils/express.js +36 -2
- package/utils/version.cjs +23 -0
- package/@types/core/location/location.d.ts +0 -317
- package/@types/core/task-tracker-factory.d.ts +0 -76
- package/@types/core/url-utils/url-utils.d.ts +0 -56
- package/@types/router/state-provider.d.ts +0 -123
- package/@types/services/browser.d.ts +0 -101
- package/docs/static/typedoc/types/SwapInsertPosition.html +0 -2
- package/jsdoc.json +0 -22
- package/src/core/location/location.js +0 -984
- package/src/core/location/location.md +0 -114
- package/src/core/task-tracker-factory.js +0 -145
- package/src/core/url-utils/url-utils.md +0 -46
- 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/browser.js +0 -212
- /package/@types/{loader.d.ts → angular.d.ts} +0 -0
- /package/src/router/{common → glob}/glob.spec.js +0 -0
- /package/src/{router/common → shared}/queue.spec.js +0 -0
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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CompileProvider } from "./core/compile/compile.js";
|
|
2
2
|
import {
|
|
3
|
+
hiddenInputBrowserCacheDirective,
|
|
3
4
|
inputDirective,
|
|
4
5
|
ngValueDirective,
|
|
5
|
-
hiddenInputBrowserCacheDirective,
|
|
6
6
|
} from "./directive/input/input.js";
|
|
7
7
|
import { formDirective, ngFormDirective } from "./directive/form/form.js";
|
|
8
8
|
import { scriptDirective } from "./directive/script/script.js";
|
|
9
|
-
import {
|
|
9
|
+
import { optionDirective, selectDirective } from "./directive/select/select.js";
|
|
10
10
|
import {
|
|
11
11
|
ngBindDirective,
|
|
12
12
|
ngBindHtmlDirective,
|
|
@@ -34,9 +34,9 @@ import { ngRefDirective } from "./directive/ref/ref.js";
|
|
|
34
34
|
import { ngRepeatDirective } from "./directive/repeat/repeat.js";
|
|
35
35
|
import { ngStyleDirective } from "./directive/style/style.js";
|
|
36
36
|
import {
|
|
37
|
+
ngSwitchDefaultDirective,
|
|
37
38
|
ngSwitchDirective,
|
|
38
39
|
ngSwitchWhenDirective,
|
|
39
|
-
ngSwitchDefaultDirective,
|
|
40
40
|
} from "./directive/switch/switch.js";
|
|
41
41
|
import { ngOptionsDirective } from "./directive/options/options.js";
|
|
42
42
|
import { ngTranscludeDirective } from "./directive/transclude/transclude.js";
|
|
@@ -52,27 +52,25 @@ import { ngAttributeAliasDirectives } from "./directive/attrs/attrs.js";
|
|
|
52
52
|
import { ngEventDirectives } from "./directive/events/events.js";
|
|
53
53
|
import { AnchorScrollProvider } from "./services/anchor-scroll.js";
|
|
54
54
|
import { AnimateProvider } from "./animations/animate.js";
|
|
55
|
-
import { BrowserProvider } from "./services/browser.js";
|
|
56
55
|
import {
|
|
57
56
|
AnimateAsyncRunFactoryProvider,
|
|
58
57
|
AnimateRunnerFactoryProvider,
|
|
59
58
|
} from "./animations/animate-runner.js";
|
|
60
59
|
import { TemplateCacheProvider } from "./services/template-cache/template-cache.js";
|
|
61
60
|
import { ControllerProvider } from "./core/controller/controller.js";
|
|
62
|
-
import { ExceptionHandlerProvider } from "./
|
|
61
|
+
import { ExceptionHandlerProvider } from "./services/exception/exception-handler.js";
|
|
63
62
|
import { FilterProvider } from "./core/filter/filter.js";
|
|
64
63
|
import { InterpolateProvider } from "./core/interpolate/interpolate.js";
|
|
65
64
|
import {
|
|
66
|
-
HttpProvider,
|
|
67
65
|
HttpParamSerializerProvider,
|
|
66
|
+
HttpProvider,
|
|
68
67
|
} from "./services/http/http.js";
|
|
69
68
|
import { HttpBackendProvider } from "./services/http-backend/http-backend.js";
|
|
70
|
-
import { LocationProvider } from "./
|
|
69
|
+
import { LocationProvider } from "./services/location/location.js";
|
|
71
70
|
import { LogProvider } from "./services/log/log.js";
|
|
72
71
|
import { ParseProvider } from "./core/parse/parse.js";
|
|
73
72
|
import { RootScopeProvider } from "./core/scope/scope.js";
|
|
74
|
-
import {
|
|
75
|
-
import { TaskTrackerFactoryProvider } from "./core/task-tracker-factory.js";
|
|
73
|
+
import { SceDelegateProvider, SceProvider } from "./services/sce/sce.js";
|
|
76
74
|
import { TemplateRequestProvider } from "./services/template-request.js";
|
|
77
75
|
import { SanitizeUriProvider } from "./core/sanitize/sanitize-uri.js";
|
|
78
76
|
import {
|
|
@@ -134,27 +132,28 @@ import {
|
|
|
134
132
|
ngPostDirective,
|
|
135
133
|
ngPutDirective,
|
|
136
134
|
} from "./directive/http/http.js";
|
|
135
|
+
import { $injectTokens as $t } from "./injection-tokens.js";
|
|
137
136
|
|
|
138
137
|
/**
|
|
139
138
|
* Initializes core `ng` module.
|
|
140
|
-
* @param {import('./
|
|
139
|
+
* @param {import('./angular.js').Angular} angular
|
|
141
140
|
* @returns {import('./core/di/ng-module.js').NgModule} `ng` module
|
|
142
141
|
*/
|
|
143
142
|
export function registerNgModule(angular) {
|
|
144
|
-
|
|
143
|
+
return angular
|
|
145
144
|
.module(
|
|
146
145
|
"ng",
|
|
147
146
|
[],
|
|
148
147
|
[
|
|
149
|
-
|
|
150
|
-
/** @
|
|
148
|
+
$t.$provide,
|
|
149
|
+
/** @param {import("./interface.js").Provider} $provide */
|
|
151
150
|
($provide) => {
|
|
152
151
|
// $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
|
|
153
152
|
$provide.provider({
|
|
154
153
|
$$sanitizeUri: SanitizeUriProvider,
|
|
155
154
|
});
|
|
156
155
|
$provide
|
|
157
|
-
.provider(
|
|
156
|
+
.provider($t.$compile, CompileProvider)
|
|
158
157
|
.directive({
|
|
159
158
|
input: inputDirective,
|
|
160
159
|
textarea: inputDirective,
|
|
@@ -248,7 +247,6 @@ export function registerNgModule(angular) {
|
|
|
248
247
|
$$animateQueue: AnimateQueueProvider,
|
|
249
248
|
$$AnimateRunner: AnimateRunnerFactoryProvider,
|
|
250
249
|
$$animateAsyncRun: AnimateAsyncRunFactoryProvider,
|
|
251
|
-
$browser: BrowserProvider,
|
|
252
250
|
$controller: ControllerProvider,
|
|
253
251
|
$exceptionHandler: ExceptionHandlerProvider,
|
|
254
252
|
$filter: FilterProvider,
|
|
@@ -264,7 +262,6 @@ export function registerNgModule(angular) {
|
|
|
264
262
|
$routerGlobals: RouterGlobals,
|
|
265
263
|
$sce: SceProvider,
|
|
266
264
|
$sceDelegate: SceDelegateProvider,
|
|
267
|
-
$$taskTrackerFactory: TaskTrackerFactoryProvider,
|
|
268
265
|
$templateCache: TemplateCacheProvider,
|
|
269
266
|
$templateRequest: TemplateRequestProvider,
|
|
270
267
|
$urlConfig: UrlConfigProvider,
|
|
@@ -273,7 +270,7 @@ export function registerNgModule(angular) {
|
|
|
273
270
|
$state: StateProvider,
|
|
274
271
|
$ngViewScroll: ViewScrollProvider,
|
|
275
272
|
$templateFactory: TemplateFactoryProvider,
|
|
276
|
-
$
|
|
273
|
+
$url: UrlService,
|
|
277
274
|
$stateRegistry: StateRegistryProvider,
|
|
278
275
|
$eventBus: PubSubProvider,
|
|
279
276
|
});
|
|
@@ -281,16 +278,12 @@ export function registerNgModule(angular) {
|
|
|
281
278
|
],
|
|
282
279
|
)
|
|
283
280
|
.factory("$stateParams", [
|
|
284
|
-
|
|
281
|
+
$t.$routerGlobals,
|
|
285
282
|
/**
|
|
286
283
|
* @param {import('./router/globals.js').RouterGlobals} globals
|
|
287
284
|
* @returns {import('./router/params/state-params.js').StateParams }
|
|
288
285
|
*/
|
|
289
|
-
|
|
290
|
-
return globals.params;
|
|
291
|
-
},
|
|
286
|
+
(globals) => globals.params,
|
|
292
287
|
])
|
|
293
288
|
.value("$trace", trace);
|
|
294
|
-
|
|
295
|
-
return ng;
|
|
296
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"));
|
|
@@ -26,11 +26,12 @@ describe("ngStateRef", () => {
|
|
|
26
26
|
module.config(
|
|
27
27
|
/**
|
|
28
28
|
* @param $stateProvider
|
|
29
|
-
* @param {import('../../
|
|
29
|
+
* @param {import('../../services/location/location.js').LocationProvider} $locationProvider
|
|
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";
|
|
@@ -143,11 +138,20 @@ import { getLocals } from "../state/state-registry.js";
|
|
|
143
138
|
* });
|
|
144
139
|
* ```
|
|
145
140
|
*/
|
|
141
|
+
|
|
142
|
+
/** @type {import("../../interface.js").AnnotatedDirectiveFactory} */
|
|
146
143
|
export let ngView = [
|
|
147
144
|
"$view",
|
|
148
145
|
"$animate",
|
|
149
146
|
"$ngViewScroll",
|
|
150
147
|
"$interpolate",
|
|
148
|
+
/**
|
|
149
|
+
* @param {*} $view
|
|
150
|
+
* @param {*} $animate
|
|
151
|
+
* @param {*} $ngViewScroll
|
|
152
|
+
* @param {*} $interpolate
|
|
153
|
+
* @returns {import("../../interface.js").Directive}
|
|
154
|
+
*/
|
|
151
155
|
function $ViewDirective($view, $animate, $ngViewScroll, $interpolate) {
|
|
152
156
|
function getRenderer() {
|
|
153
157
|
return {
|
|
@@ -178,7 +182,6 @@ export let ngView = [
|
|
|
178
182
|
};
|
|
179
183
|
const directive = {
|
|
180
184
|
count: 0,
|
|
181
|
-
|
|
182
185
|
terminal: true,
|
|
183
186
|
priority: 400,
|
|
184
187
|
transclude: "element",
|
|
@@ -275,7 +278,7 @@ export let ngView = [
|
|
|
275
278
|
* @param {string} viewName Name of the view.
|
|
276
279
|
*/
|
|
277
280
|
newScope.$emit("$viewContentLoading", name);
|
|
278
|
-
|
|
281
|
+
currentEl = $transclude(newScope, function (clone) {
|
|
279
282
|
setCacheData(clone, "$ngViewAnim", $ngViewAnim);
|
|
280
283
|
setCacheData(clone, "$ngView", $ngViewData);
|
|
281
284
|
renderer.enter(clone, $element, function () {
|
|
@@ -291,7 +294,6 @@ export let ngView = [
|
|
|
291
294
|
});
|
|
292
295
|
cleanupLastView();
|
|
293
296
|
});
|
|
294
|
-
currentEl = cloned;
|
|
295
297
|
currentScope = newScope;
|
|
296
298
|
/**
|
|
297
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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StateParams } from "./params/state-params.js";
|
|
2
|
-
import { Queue } from "
|
|
2
|
+
import { Queue } from "../shared/queue.js";
|
|
3
3
|
|
|
4
4
|
/** @typedef {import('../interface.ts').ServiceProvider} ServiceProvider } */
|
|
5
5
|
|
|
@@ -8,7 +8,6 @@ import { Queue } from "./common/queue.js";
|
|
|
8
8
|
*
|
|
9
9
|
* This is where we hold the global mutable state such as current state, current
|
|
10
10
|
* params, current transition, etc.
|
|
11
|
-
* @implements {ServiceProvider}
|
|
12
11
|
*/
|
|
13
12
|
export class RouterGlobals {
|
|
14
13
|
constructor() {
|
|
@@ -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 */
|