@angular-wave/angular.ts 0.7.8 → 0.8.1
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/{loader.d.ts → angular.d.ts} +3 -3
- package/@types/core/di/ng-module.d.ts +61 -25
- 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 +4 -2
- package/@types/{public.d.ts → ng.d.ts} +2 -2
- package/@types/router/directives/state-directives.d.ts +2 -2
- package/@types/router/directives/view-directive.d.ts +1 -1
- package/@types/router/params/param-type.d.ts +0 -1
- package/@types/router/path/path-utils.d.ts +8 -11
- package/@types/router/{globals.d.ts → router.d.ts} +2 -2
- 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 +2 -2
- package/@types/router/state/state-service.d.ts +14 -16
- package/@types/router/state-filters.d.ts +24 -2
- package/@types/router/transition/transition-service.d.ts +3 -3
- package/@types/router/transition/transition.d.ts +16 -19
- package/@types/router/url/url-matcher.d.ts +3 -4
- package/@types/router/url/url-rule.d.ts +14 -4
- 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/hof.d.ts +0 -6
- 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/CHANGELOG.md +0 -72
- package/CONTRIBUTING.md +0 -1
- package/DEVELOPERS.md +0 -1
- package/Makefile +6 -3
- package/TRIAGING.md +0 -1
- package/dist/angular-ts.esm.js +1048 -1150
- package/dist/angular-ts.umd.js +1048 -1150
- 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/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 +3 -3
- 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/Injectable.html +4 -1
- package/docs/static/typedoc/types/InjectableFactory.html +1 -4
- 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 +2 -2
- package/src/{loader.js → angular.js} +11 -11
- 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/di/ng-module.js +26 -21
- 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 +46 -46
- 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 +6 -6
- 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.md +0 -4
- 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.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 +7 -3
- package/src/interface.ts +4 -3
- package/src/loader.md +0 -155
- package/src/{public.js → ng.js} +11 -12
- package/src/{public.spec.js → ng.spec.js} +2 -2
- package/src/router/directives/state-directives.js +5 -5
- package/src/router/directives/state-directives.spec.js +8 -7
- package/src/router/directives/view-directive.js +7 -13
- package/src/router/directives/view-directive.spec.js +22 -23
- 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/params/param-type.js +0 -1
- package/src/router/params/param.js +1 -1
- package/src/router/path/path-utils.js +5 -0
- package/src/router/router-test-hashbang.html +45 -0
- package/src/router/{globals.js → router.js} +2 -2
- package/src/router/services.spec.js +8 -9
- 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 +4 -4
- package/src/router/state/state-service.js +14 -14
- 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 +7 -7
- package/src/router/transition/hook-registry.js +1 -1
- package/src/router/transition/transition-service.js +7 -6
- package/src/router/transition/transition.js +6 -6
- package/src/router/url/url-matcher.js +12 -14
- package/src/router/url/url-rule.js +8 -2
- package/src/router/url/url-rules.js +8 -5
- package/src/router/url/url-service.js +80 -76
- package/src/router/url/url-service.spec.js +61 -78
- 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.js +3 -1
- package/src/router/view-scroll.spec.js +12 -12
- 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 +439 -519
- package/src/services/location/location.spec.js +915 -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 +5 -10
- package/src/shared/common.spec.js +1 -1
- package/src/shared/hof.js +0 -14
- 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/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
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The Angular 1 `StateProvider`
|
|
3
|
-
*
|
|
4
|
-
* The `$stateProvider` works similar to Angular's v1 router, but it focuses purely
|
|
5
|
-
* on state.
|
|
6
|
-
*
|
|
7
|
-
* A state corresponds to a "place" in the application in terms of the overall UI and
|
|
8
|
-
* navigation. A state describes (via the controller / template / view properties) what
|
|
9
|
-
* the UI looks like and does at that place.
|
|
10
|
-
*
|
|
11
|
-
* States often have things in common, and the primary way of factoring out these
|
|
12
|
-
* commonalities in this model is via the state hierarchy, i.e. parent/child states aka
|
|
13
|
-
* nested states.
|
|
14
|
-
*
|
|
15
|
-
* The `$stateProvider` provides interfaces to declare these states for your app.
|
|
16
|
-
*/
|
|
17
|
-
export class StateProvider {
|
|
18
|
-
constructor(stateRegistry: any, stateService: any);
|
|
19
|
-
stateRegistry: any;
|
|
20
|
-
stateService: any;
|
|
21
|
-
/**
|
|
22
|
-
* Decorates states when they are registered
|
|
23
|
-
*
|
|
24
|
-
* Allows you to extend (carefully) or override (at your own peril) the
|
|
25
|
-
* `stateBuilder` object used internally by [[StateRegistry]].
|
|
26
|
-
* This can be used to add custom functionality to ng-router,
|
|
27
|
-
* for example inferring templateUrl based on the state name.
|
|
28
|
-
*
|
|
29
|
-
* When passing only a name, it returns the current (original or decorated) builder
|
|
30
|
-
* function that matches `name`.
|
|
31
|
-
*
|
|
32
|
-
* The builder functions that can be decorated are listed below. Though not all
|
|
33
|
-
* necessarily have a good use case for decoration, that is up to you to decide.
|
|
34
|
-
*
|
|
35
|
-
* In addition, users can attach custom decorators, which will generate new
|
|
36
|
-
* properties within the state's internal definition. There is currently no clear
|
|
37
|
-
* use-case for this beyond accessing internal states (i.e. $state.$current),
|
|
38
|
-
* however, expect this to become increasingly relevant as we introduce additional
|
|
39
|
-
* meta-programming features.
|
|
40
|
-
*
|
|
41
|
-
* **Warning**: Decorators should not be interdependent because the order of
|
|
42
|
-
* execution of the builder functions in non-deterministic. Builder functions
|
|
43
|
-
* should only be dependent on the state definition object and super function.
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* Existing builder functions and current return values:
|
|
47
|
-
*
|
|
48
|
-
* - **parent** `{object}` - returns the parent state object.
|
|
49
|
-
* - **data** `{object}` - returns state data, including any inherited data that is not
|
|
50
|
-
* overridden by own values (if any).
|
|
51
|
-
* - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}
|
|
52
|
-
* or `null`.
|
|
53
|
-
* - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is
|
|
54
|
-
* navigable).
|
|
55
|
-
* - **params** `{object}` - returns an array of state params that are ensured to
|
|
56
|
-
* be a super-set of parent's params.
|
|
57
|
-
* - **views** `{object}` - returns a views object where each key is an absolute view
|
|
58
|
-
* name (i.e. "viewName@stateName") and each value is the config object
|
|
59
|
-
* (template, controller) for the view. Even when you don't use the views object
|
|
60
|
-
* explicitly on a state config, one is still created for you internally.
|
|
61
|
-
* So by decorating this builder function you have access to decorating template
|
|
62
|
-
* and controller properties.
|
|
63
|
-
* - **ownParams** `{object}` - returns an array of params that belong to the state,
|
|
64
|
-
* not including any params defined by ancestor states.
|
|
65
|
-
* - **path** `{string}` - returns the full path from the root down to this state.
|
|
66
|
-
* Needed for state activation.
|
|
67
|
-
* - **includes** `{object}` - returns an object that includes every state that
|
|
68
|
-
* would pass a `$state.includes()` test.
|
|
69
|
-
*
|
|
70
|
-
* #### Example:
|
|
71
|
-
* Override the internal 'views' builder with a function that takes the state
|
|
72
|
-
* definition, and a reference to the internal function being overridden:
|
|
73
|
-
* ```js
|
|
74
|
-
* $stateProvider.decorator('views', function (state, parent) {
|
|
75
|
-
* let result = {},
|
|
76
|
-
* views = parent(state);
|
|
77
|
-
*
|
|
78
|
-
* forEach(views, function (config, name) {
|
|
79
|
-
* let autoName = (state.name + '.' + name).replace('.', '/');
|
|
80
|
-
* config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';
|
|
81
|
-
* result[name] = config;
|
|
82
|
-
* });
|
|
83
|
-
* return result;
|
|
84
|
-
* });
|
|
85
|
-
*
|
|
86
|
-
* $stateProvider.state('home', {
|
|
87
|
-
* views: {
|
|
88
|
-
* 'contact.list': { controller: 'ListController' },
|
|
89
|
-
* 'contact.item': { controller: 'ItemController' }
|
|
90
|
-
* }
|
|
91
|
-
* });
|
|
92
|
-
* ```
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* ```js
|
|
96
|
-
* // Auto-populates list and item views with /partials/home/contact/list.html,
|
|
97
|
-
* // and /partials/home/contact/item.html, respectively.
|
|
98
|
-
* $state.go('home');
|
|
99
|
-
* ```
|
|
100
|
-
*
|
|
101
|
-
* @param {string} name The name of the builder function to decorate.
|
|
102
|
-
* @param {object} func A function that is responsible for decorating the original
|
|
103
|
-
* builder function. The function receives two parameters:
|
|
104
|
-
*
|
|
105
|
-
* - `{object}` - state - The state config object.
|
|
106
|
-
* - `{object}` - super - The original builder function.
|
|
107
|
-
*
|
|
108
|
-
* @return {object} $stateProvider - $stateProvider instance
|
|
109
|
-
*/
|
|
110
|
-
decorator(name: string, func: object): object;
|
|
111
|
-
/**
|
|
112
|
-
*
|
|
113
|
-
* @param {*} definition
|
|
114
|
-
* @returns {StateProvider}
|
|
115
|
-
*/
|
|
116
|
-
state(definition: any): StateProvider;
|
|
117
|
-
/**
|
|
118
|
-
* Registers an invalid state handler
|
|
119
|
-
*
|
|
120
|
-
* This is a passthrough to [[StateService.onInvalid]] for ng1.
|
|
121
|
-
*/
|
|
122
|
-
onInvalid(callback: any): any;
|
|
123
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
## `ngNonBindable` Directive
|
|
2
|
-
|
|
3
|
-
### Restrict
|
|
4
|
-
|
|
5
|
-
`AC`
|
|
6
|
-
|
|
7
|
-
### Priority
|
|
8
|
-
|
|
9
|
-
1000
|
|
10
|
-
|
|
11
|
-
### Element
|
|
12
|
-
|
|
13
|
-
`ANY`
|
|
14
|
-
|
|
15
|
-
### Description
|
|
16
|
-
|
|
17
|
-
The `ngNonBindable` directive tells AngularTS not to compile or bind the contents of the current DOM element, including directives on the element itself that have a lower priority than `ngNonBindable`. This is useful if the element contains what appears to be AngularTS directives and bindings but which should be ignored by AngularTS. This could be the case if you have a site that displays snippets of code, for instance.
|
package/src/loader.spec.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
import { Angular } from "./loader.js";
|
|
2
|
-
import { createInjector } from "./core/di/injector.js";
|
|
3
|
-
|
|
4
|
-
describe("module loader", () => {
|
|
5
|
-
let angular;
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
angular = window.angular = new Angular();
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
it("allows registering a module", () => {
|
|
11
|
-
const myModule = angular.module("myModule", []);
|
|
12
|
-
expect(myModule).toBeDefined();
|
|
13
|
-
expect(myModule.name).toEqual("myModule");
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
it("allows getting a module", () => {
|
|
17
|
-
const myModule = angular.module("myModule", []);
|
|
18
|
-
const gotModule = angular.module("myModule");
|
|
19
|
-
expect(gotModule).toBeDefined();
|
|
20
|
-
expect(gotModule).toBe(myModule);
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("throws when trying to get a nonexistent module", () => {
|
|
24
|
-
expect(() => {
|
|
25
|
-
angular.module("nonexistent");
|
|
26
|
-
}).toThrow();
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("does not allow a module to be called hasOwnProperty", () => {
|
|
30
|
-
expect(() => {
|
|
31
|
-
angular.module("hasOwnProperty", []);
|
|
32
|
-
}).toThrow();
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("attaches the requires array to the registered module", () => {
|
|
36
|
-
const myModule = angular.module("myModule", ["myOtherModule"]);
|
|
37
|
-
expect(myModule.requires).toEqual(["myOtherModule"]);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it("replaces a module when registered with same name again", () => {
|
|
41
|
-
const myModule = angular.module("myModule", []);
|
|
42
|
-
const myNewModule = angular.module("myModule", []);
|
|
43
|
-
expect(myNewModule).not.toBe(myModule);
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
it("should record calls", () => {
|
|
47
|
-
const otherModule = angular.module("other", []);
|
|
48
|
-
otherModule.config("otherInit");
|
|
49
|
-
|
|
50
|
-
const myModule = angular.module("my", ["other"], "config");
|
|
51
|
-
|
|
52
|
-
expect(
|
|
53
|
-
myModule
|
|
54
|
-
.decorator("dk", "dv")
|
|
55
|
-
.provider("sk", "sv")
|
|
56
|
-
.factory("fk", "fv")
|
|
57
|
-
.service("a", "aa")
|
|
58
|
-
.value("k", "v")
|
|
59
|
-
.filter("f", "ff")
|
|
60
|
-
.directive("d", "dd")
|
|
61
|
-
.component("c", "cc")
|
|
62
|
-
.controller("ctrl", "ccc")
|
|
63
|
-
.config("init2")
|
|
64
|
-
.constant("abc", 123)
|
|
65
|
-
.run("runBlock"),
|
|
66
|
-
).toBe(myModule);
|
|
67
|
-
|
|
68
|
-
expect(myModule.requires).toEqual(["other"]);
|
|
69
|
-
expect(myModule.invokeQueue).toEqual([
|
|
70
|
-
["$provide", "constant", jasmine.objectContaining(["abc", 123])],
|
|
71
|
-
["$provide", "provider", jasmine.objectContaining(["sk", "sv"])],
|
|
72
|
-
["$provide", "factory", jasmine.objectContaining(["fk", "fv"])],
|
|
73
|
-
["$provide", "service", jasmine.objectContaining(["a", "aa"])],
|
|
74
|
-
["$provide", "value", jasmine.objectContaining(["k", "v"])],
|
|
75
|
-
["$filterProvider", "register", jasmine.objectContaining(["f", "ff"])],
|
|
76
|
-
["$compileProvider", "directive", jasmine.objectContaining(["d", "dd"])],
|
|
77
|
-
["$compileProvider", "component", jasmine.objectContaining(["c", "cc"])],
|
|
78
|
-
[
|
|
79
|
-
"$controllerProvider",
|
|
80
|
-
"register",
|
|
81
|
-
jasmine.objectContaining(["ctrl", "ccc"]),
|
|
82
|
-
],
|
|
83
|
-
]);
|
|
84
|
-
expect(myModule.configBlocks).toEqual([
|
|
85
|
-
["$injector", "invoke", jasmine.objectContaining(["config"])],
|
|
86
|
-
["$provide", "decorator", jasmine.objectContaining(["dk", "dv"])],
|
|
87
|
-
["$injector", "invoke", jasmine.objectContaining(["init2"])],
|
|
88
|
-
]);
|
|
89
|
-
expect(myModule.runBlocks).toEqual(["runBlock"]);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("should not throw error when `module.decorator` is declared before provider that it decorates", () => {
|
|
93
|
-
angular
|
|
94
|
-
.module("theModule", [])
|
|
95
|
-
.decorator("theProvider", ($delegate) => $delegate)
|
|
96
|
-
.factory("theProvider", () => ({}));
|
|
97
|
-
|
|
98
|
-
expect(() => {
|
|
99
|
-
createInjector(["theModule"]);
|
|
100
|
-
}).not.toThrow();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it("should run decorators in order of declaration, even when mixed with provider.decorator", () => {
|
|
104
|
-
let log = "";
|
|
105
|
-
|
|
106
|
-
angular
|
|
107
|
-
.module("theModule", [])
|
|
108
|
-
.factory("theProvider", () => ({ api: "provider" }))
|
|
109
|
-
.decorator("theProvider", ($delegate) => {
|
|
110
|
-
$delegate.api += "-first";
|
|
111
|
-
return $delegate;
|
|
112
|
-
})
|
|
113
|
-
.config(($provide) => {
|
|
114
|
-
$provide.decorator("theProvider", ($delegate) => {
|
|
115
|
-
$delegate.api += "-second";
|
|
116
|
-
return $delegate;
|
|
117
|
-
});
|
|
118
|
-
})
|
|
119
|
-
.decorator("theProvider", ($delegate) => {
|
|
120
|
-
$delegate.api += "-third";
|
|
121
|
-
return $delegate;
|
|
122
|
-
})
|
|
123
|
-
.run((theProvider) => {
|
|
124
|
-
log = theProvider.api;
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
createInjector(["theModule"]);
|
|
128
|
-
expect(log).toBe("provider-first-second-third");
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it("should decorate the last declared provider if multiple have been declared", () => {
|
|
132
|
-
let log = "";
|
|
133
|
-
|
|
134
|
-
angular
|
|
135
|
-
.module("theModule", [])
|
|
136
|
-
.factory("theProvider", () => ({
|
|
137
|
-
api: "firstProvider",
|
|
138
|
-
}))
|
|
139
|
-
.decorator("theProvider", ($delegate) => {
|
|
140
|
-
$delegate.api += "-decorator";
|
|
141
|
-
return $delegate;
|
|
142
|
-
})
|
|
143
|
-
.factory("theProvider", () => ({
|
|
144
|
-
api: "secondProvider",
|
|
145
|
-
}))
|
|
146
|
-
.run((theProvider) => {
|
|
147
|
-
log = theProvider.api;
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
createInjector(["theModule"]);
|
|
151
|
-
expect(log).toBe("secondProvider-decorator");
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
it("should allow module redefinition", () => {
|
|
155
|
-
expect(angular.module("a", [])).not.toBe(angular.module("a", []));
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
it("should complain of no module", () => {
|
|
159
|
-
expect(() => {
|
|
160
|
-
angular.module("dontExist");
|
|
161
|
-
}).toThrow();
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it('should complain if a module is called "hasOwnProperty', () => {
|
|
165
|
-
expect(() => {
|
|
166
|
-
angular.module("hasOwnProperty", []);
|
|
167
|
-
}).toThrow();
|
|
168
|
-
});
|
|
169
|
-
});
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { val } from "../shared/hof.js";
|
|
2
|
-
import { createProxyFunctions } from "../shared/common.js";
|
|
3
|
-
import { minErr } from "../shared/utils.js";
|
|
4
|
-
|
|
5
|
-
const err = minErr("$stateProvider");
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* The Angular 1 `StateProvider`
|
|
9
|
-
*
|
|
10
|
-
* The `$stateProvider` works similar to Angular's v1 router, but it focuses purely
|
|
11
|
-
* on state.
|
|
12
|
-
*
|
|
13
|
-
* A state corresponds to a "place" in the application in terms of the overall UI and
|
|
14
|
-
* navigation. A state describes (via the controller / template / view properties) what
|
|
15
|
-
* the UI looks like and does at that place.
|
|
16
|
-
*
|
|
17
|
-
* States often have things in common, and the primary way of factoring out these
|
|
18
|
-
* commonalities in this model is via the state hierarchy, i.e. parent/child states aka
|
|
19
|
-
* nested states.
|
|
20
|
-
*
|
|
21
|
-
* The `$stateProvider` provides interfaces to declare these states for your app.
|
|
22
|
-
*/
|
|
23
|
-
export class StateProvider {
|
|
24
|
-
constructor(stateRegistry, stateService) {
|
|
25
|
-
this.stateRegistry = stateRegistry;
|
|
26
|
-
this.stateService = stateService;
|
|
27
|
-
createProxyFunctions(val(StateProvider.prototype), this, val(this));
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Decorates states when they are registered
|
|
31
|
-
*
|
|
32
|
-
* Allows you to extend (carefully) or override (at your own peril) the
|
|
33
|
-
* `stateBuilder` object used internally by [[StateRegistry]].
|
|
34
|
-
* This can be used to add custom functionality to ng-router,
|
|
35
|
-
* for example inferring templateUrl based on the state name.
|
|
36
|
-
*
|
|
37
|
-
* When passing only a name, it returns the current (original or decorated) builder
|
|
38
|
-
* function that matches `name`.
|
|
39
|
-
*
|
|
40
|
-
* The builder functions that can be decorated are listed below. Though not all
|
|
41
|
-
* necessarily have a good use case for decoration, that is up to you to decide.
|
|
42
|
-
*
|
|
43
|
-
* In addition, users can attach custom decorators, which will generate new
|
|
44
|
-
* properties within the state's internal definition. There is currently no clear
|
|
45
|
-
* use-case for this beyond accessing internal states (i.e. $state.$current),
|
|
46
|
-
* however, expect this to become increasingly relevant as we introduce additional
|
|
47
|
-
* meta-programming features.
|
|
48
|
-
*
|
|
49
|
-
* **Warning**: Decorators should not be interdependent because the order of
|
|
50
|
-
* execution of the builder functions in non-deterministic. Builder functions
|
|
51
|
-
* should only be dependent on the state definition object and super function.
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* Existing builder functions and current return values:
|
|
55
|
-
*
|
|
56
|
-
* - **parent** `{object}` - returns the parent state object.
|
|
57
|
-
* - **data** `{object}` - returns state data, including any inherited data that is not
|
|
58
|
-
* overridden by own values (if any).
|
|
59
|
-
* - **url** `{object}` - returns a {@link ui.router.util.type:UrlMatcher UrlMatcher}
|
|
60
|
-
* or `null`.
|
|
61
|
-
* - **navigable** `{object}` - returns closest ancestor state that has a URL (aka is
|
|
62
|
-
* navigable).
|
|
63
|
-
* - **params** `{object}` - returns an array of state params that are ensured to
|
|
64
|
-
* be a super-set of parent's params.
|
|
65
|
-
* - **views** `{object}` - returns a views object where each key is an absolute view
|
|
66
|
-
* name (i.e. "viewName@stateName") and each value is the config object
|
|
67
|
-
* (template, controller) for the view. Even when you don't use the views object
|
|
68
|
-
* explicitly on a state config, one is still created for you internally.
|
|
69
|
-
* So by decorating this builder function you have access to decorating template
|
|
70
|
-
* and controller properties.
|
|
71
|
-
* - **ownParams** `{object}` - returns an array of params that belong to the state,
|
|
72
|
-
* not including any params defined by ancestor states.
|
|
73
|
-
* - **path** `{string}` - returns the full path from the root down to this state.
|
|
74
|
-
* Needed for state activation.
|
|
75
|
-
* - **includes** `{object}` - returns an object that includes every state that
|
|
76
|
-
* would pass a `$state.includes()` test.
|
|
77
|
-
*
|
|
78
|
-
* #### Example:
|
|
79
|
-
* Override the internal 'views' builder with a function that takes the state
|
|
80
|
-
* definition, and a reference to the internal function being overridden:
|
|
81
|
-
* ```js
|
|
82
|
-
* $stateProvider.decorator('views', function (state, parent) {
|
|
83
|
-
* let result = {},
|
|
84
|
-
* views = parent(state);
|
|
85
|
-
*
|
|
86
|
-
* forEach(views, function (config, name) {
|
|
87
|
-
* let autoName = (state.name + '.' + name).replace('.', '/');
|
|
88
|
-
* config.templateUrl = config.templateUrl || '/partials/' + autoName + '.html';
|
|
89
|
-
* result[name] = config;
|
|
90
|
-
* });
|
|
91
|
-
* return result;
|
|
92
|
-
* });
|
|
93
|
-
*
|
|
94
|
-
* $stateProvider.state('home', {
|
|
95
|
-
* views: {
|
|
96
|
-
* 'contact.list': { controller: 'ListController' },
|
|
97
|
-
* 'contact.item': { controller: 'ItemController' }
|
|
98
|
-
* }
|
|
99
|
-
* });
|
|
100
|
-
* ```
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* ```js
|
|
104
|
-
* // Auto-populates list and item views with /partials/home/contact/list.html,
|
|
105
|
-
* // and /partials/home/contact/item.html, respectively.
|
|
106
|
-
* $state.go('home');
|
|
107
|
-
* ```
|
|
108
|
-
*
|
|
109
|
-
* @param {string} name The name of the builder function to decorate.
|
|
110
|
-
* @param {object} func A function that is responsible for decorating the original
|
|
111
|
-
* builder function. The function receives two parameters:
|
|
112
|
-
*
|
|
113
|
-
* - `{object}` - state - The state config object.
|
|
114
|
-
* - `{object}` - super - The original builder function.
|
|
115
|
-
*
|
|
116
|
-
* @return {object} $stateProvider - $stateProvider instance
|
|
117
|
-
*/
|
|
118
|
-
decorator(name, func) {
|
|
119
|
-
return this.stateRegistry.decorator(name, func) || this;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
*
|
|
124
|
-
* @param {*} definition
|
|
125
|
-
* @returns {StateProvider}
|
|
126
|
-
*/
|
|
127
|
-
state(definition) {
|
|
128
|
-
if (!definition.name) {
|
|
129
|
-
throw err("stateinvalid", `'name' required`);
|
|
130
|
-
}
|
|
131
|
-
try {
|
|
132
|
-
this.stateRegistry.register(definition);
|
|
133
|
-
} catch (e) {
|
|
134
|
-
throw err("stateinvalid", e.message);
|
|
135
|
-
}
|
|
136
|
-
return this;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Registers an invalid state handler
|
|
140
|
-
*
|
|
141
|
-
* This is a passthrough to [[StateService.onInvalid]] for ng1.
|
|
142
|
-
*/
|
|
143
|
-
onInvalid(callback) {
|
|
144
|
-
return this.stateService.onInvalid(callback);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
/\*\*
|
|
2
|
-
|
|
3
|
-
- The $location service parses the URL in the browser address bar (based on the
|
|
4
|
-
- [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL
|
|
5
|
-
- available to your application. Changes to the URL in the address bar are reflected into
|
|
6
|
-
- $location service and changes to $location are reflected into the browser address bar.
|
|
7
|
-
-
|
|
8
|
-
- **The $location service:**
|
|
9
|
-
-
|
|
10
|
-
- - Exposes the current URL in the browser address bar, so you can
|
|
11
|
-
- - Watch and observe the URL.
|
|
12
|
-
- - Change the URL.
|
|
13
|
-
- - Synchronizes the URL with the browser when the user
|
|
14
|
-
- - Changes the address bar.
|
|
15
|
-
- - Clicks the back or forward button (or clicks a History link).
|
|
16
|
-
- - Clicks on a link.
|
|
17
|
-
- - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
|
|
18
|
-
-
|
|
19
|
-
- For more information see {@link guide/$location Developer Guide: Using $location}
|
|
20
|
-
\*/
|
|
21
|
-
|
|
22
|
-
/\*\*
|
|
23
|
-
|
|
24
|
-
- Use the `$locationProvider` to configure how the application deep linking paths are stored.
|
|
25
|
-
\*/
|
|
26
|
-
|
|
27
|
-
/\*\*
|
|
28
|
-
|
|
29
|
-
- @ngdoc event
|
|
30
|
-
- @name $location#$locationChangeStart
|
|
31
|
-
- @eventType broadcast on root scope
|
|
32
|
-
- @description
|
|
33
|
-
- Broadcasted before a URL will change.
|
|
34
|
-
-
|
|
35
|
-
- This change can be prevented by calling
|
|
36
|
-
- `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more
|
|
37
|
-
- details about event object. Upon successful change
|
|
38
|
-
- {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.
|
|
39
|
-
-
|
|
40
|
-
- The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
|
|
41
|
-
- the browser supports the HTML5 History API.
|
|
42
|
-
-
|
|
43
|
-
- @param {Object} angularEvent Synthetic event object.
|
|
44
|
-
- @param {string} newUrl New URL
|
|
45
|
-
- @param {string=} oldUrl URL that was before it was changed.
|
|
46
|
-
- @param {string=} newState New history state object
|
|
47
|
-
- @param {string=} oldState History state object that was before it was changed.
|
|
48
|
-
\*/
|
|
49
|
-
|
|
50
|
-
/\*\*
|
|
51
|
-
|
|
52
|
-
- @ngdoc event
|
|
53
|
-
- @name $location#$locationChangeSuccess
|
|
54
|
-
- @eventType broadcast on root scope
|
|
55
|
-
- @description
|
|
56
|
-
- Broadcasted after a URL was changed.
|
|
57
|
-
-
|
|
58
|
-
- The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
|
|
59
|
-
- the browser supports the HTML5 History API.
|
|
60
|
-
-
|
|
61
|
-
- @param {Object} angularEvent Synthetic event object.
|
|
62
|
-
- @param {string} newUrl New URL
|
|
63
|
-
- @param {string=} oldUrl URL that was before it was changed.
|
|
64
|
-
- @param {string=} newState New history state object
|
|
65
|
-
- @param {string=} oldState History state object that was before it was changed.
|
|
66
|
-
\*/
|
|
67
|
-
|
|
68
|
-
/\*\*
|
|
69
|
-
|
|
70
|
-
- This method is getter / setter.
|
|
71
|
-
-
|
|
72
|
-
- Return search part (as object) of current URL when called without any parameter.
|
|
73
|
-
-
|
|
74
|
-
- Change search part when called with parameter and return `$location`.
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
- ```js
|
|
78
|
-
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
- // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
|
82
|
-
- let searchObject = $location.search();
|
|
83
|
-
- // => {foo: 'bar', baz: 'xoxo'}
|
|
84
|
-
-
|
|
85
|
-
- // set foo to 'yipee'
|
|
86
|
-
- $location.search('foo', 'yipee');
|
|
87
|
-
- // $location.search() => {foo: 'yipee', baz: 'xoxo'}
|
|
88
|
-
- ```
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
-
|
|
93
|
-
- @param {string|Object} search New search params - string or hash object.
|
|
94
|
-
-
|
|
95
|
-
- When called with a single argument the method acts as a setter, setting the `search` component
|
|
96
|
-
- of `$location` to the specified value.
|
|
97
|
-
-
|
|
98
|
-
- If the argument is a hash object containing an array of values, these values will be encoded
|
|
99
|
-
- as duplicate search parameters in the URL.
|
|
100
|
-
-
|
|
101
|
-
- @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`
|
|
102
|
-
- will override only a single search property.
|
|
103
|
-
-
|
|
104
|
-
- If `paramValue` is an array, it will override the property of the `search` component of
|
|
105
|
-
- `$location` specified via the first argument.
|
|
106
|
-
-
|
|
107
|
-
- If `paramValue` is `null`, the property specified via the first argument will be deleted.
|
|
108
|
-
-
|
|
109
|
-
- If `paramValue` is `true`, the property specified via the first argument will be added with no
|
|
110
|
-
- value nor trailing equal sign.
|
|
111
|
-
-
|
|
112
|
-
- @return {Object} If called with no arguments returns the parsed `search` object. If called with
|
|
113
|
-
- one or more arguments returns `$location` object itself.
|
|
114
|
-
\*/
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/\*\*
|
|
2
|
-
|
|
3
|
-
-
|
|
4
|
-
- Implementation Notes for non-IE browsers
|
|
5
|
-
- ***
|
|
6
|
-
- Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,
|
|
7
|
-
- results both in the normalizing and parsing of the URL. Normalizing means that a relative
|
|
8
|
-
- URL will be resolved into an absolute URL in the context of the application document.
|
|
9
|
-
- Parsing means that the anchor node's host, hostname, protocol, port, pathname and related
|
|
10
|
-
- properties are all populated to reflect the normalized URL. This approach has wide
|
|
11
|
-
- compatibility - Safari 1+, Mozilla 1+ etc. See
|
|
12
|
-
- http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
|
|
13
|
-
-
|
|
14
|
-
- Implementation Notes for IE
|
|
15
|
-
- ***
|
|
16
|
-
- IE <= 10 normalizes the URL when assigned to the anchor node similar to the other
|
|
17
|
-
- browsers. However, the parsed components will not be set if the URL assigned did not specify
|
|
18
|
-
- them. (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.) We
|
|
19
|
-
- work around that by performing the parsing in a 2nd step by taking a previously normalized
|
|
20
|
-
- URL (e.g. by assigning to a.href) and assigning it a.href again. This correctly populates the
|
|
21
|
-
- properties such as protocol, hostname, port, etc.
|
|
22
|
-
-
|
|
23
|
-
- References:
|
|
24
|
-
- http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement
|
|
25
|
-
- http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
|
|
26
|
-
- http://url.spec.whatwg.org/#urlutils
|
|
27
|
-
- https://github.com/angular/angular.js/pull/2902
|
|
28
|
-
- http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
|
|
29
|
-
-
|
|
30
|
-
- @kind function
|
|
31
|
-
- @param {string|object} url The URL to be parsed. If `url` is not a string, it will be returned
|
|
32
|
-
- unchanged.
|
|
33
|
-
- @description Normalizes and parses a URL.
|
|
34
|
-
- @returns {object} Returns the normalized URL as a dictionary.
|
|
35
|
-
-
|
|
36
|
-
- | member name | Description |
|
|
37
|
-
- |---------------|------------------------------------------------------------------------|
|
|
38
|
-
- | href | A normalized version of the provided URL if it was not an absolute URL |
|
|
39
|
-
- | protocol | The protocol without the trailing colon |
|
|
40
|
-
- | host | The host and port (if the port is non-default) of the normalizedUrl |
|
|
41
|
-
- | search | The search params, minus the question mark |
|
|
42
|
-
- | hash | The hash string, minus the hash symbol |
|
|
43
|
-
- | hostname | The hostname |
|
|
44
|
-
- | port | The port, without ":" |
|
|
45
|
-
- | pathname | The pathname, beginning with "/" |
|
|
46
|
-
- \*/
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|