@angular-wave/angular.ts 0.0.66 → 0.0.68

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.
Files changed (85) hide show
  1. package/dist/angular-ts.esm.js +2 -2
  2. package/dist/angular-ts.umd.js +2 -2
  3. package/package.json +1 -1
  4. package/src/animations/animate-js.js +4 -4
  5. package/src/animations/animate-swap.js +3 -0
  6. package/src/core/compile/compile.js +3 -3
  7. package/src/core/controller/controller.js +0 -5
  8. package/src/core/di/injector.js +9 -12
  9. package/src/core/di/internal-injector.js +113 -60
  10. package/src/core/interval/interval-factory.js +8 -1
  11. package/src/core/interval/interval.js +30 -16
  12. package/src/core/location/location.js +473 -626
  13. package/src/core/location/location.md +114 -0
  14. package/src/core/location/location.spec.js +1 -76
  15. package/src/core/parser/parse.js +1 -12
  16. package/src/core/parser/parse.spec.js +96 -110
  17. package/src/core/q/q.js +63 -65
  18. package/src/core/sce/sce.js +1 -3
  19. package/src/core/scope/scope.js +2 -5
  20. package/src/core/timeout/timeout.js +110 -111
  21. package/src/core/url-utils/url-utils.js +5 -0
  22. package/src/directive/input/input.js +32 -726
  23. package/src/directive/input/input.md +706 -0
  24. package/src/directive/options/options.js +2 -156
  25. package/src/directive/options/options.md +179 -0
  26. package/src/directive/select/select.js +55 -126
  27. package/src/directive/select/select.md +74 -0
  28. package/src/directive/show-hide/show-hide.js +13 -224
  29. package/src/directive/show-hide/show-hide.md +257 -0
  30. package/src/exts/messages/messages.js +2 -0
  31. package/src/filters/limit-to.spec.js +1 -1
  32. package/src/filters/order-by.spec.js +1 -1
  33. package/src/index.js +6 -2
  34. package/src/loader.js +7 -3
  35. package/src/public.js +1 -7
  36. package/src/router/params/param.js +54 -54
  37. package/src/router/path/path-utils.js +1 -0
  38. package/src/router/state/state-builder.js +2 -4
  39. package/src/router/state/state-service.js +1 -1
  40. package/src/router/state-provider.js +1 -1
  41. package/src/router/template-factory.js +10 -10
  42. package/src/router/url/url-service.js +11 -4
  43. package/src/services/anchor-scroll.js +3 -5
  44. package/src/services/browser.js +2 -9
  45. package/src/services/cache-factory.js +0 -67
  46. package/src/services/cache-factory.md +75 -0
  47. package/src/services/cookie-reader.js +36 -55
  48. package/src/services/http/http.js +62 -587
  49. package/src/services/http/http.md +413 -0
  50. package/src/services/http-backend/http-backend.js +19 -44
  51. package/src/services/template-request.js +1 -9
  52. package/src/shared/jqlite/jqlite.js +5 -70
  53. package/src/types.js +2 -4
  54. package/types/animations/animate-swap.d.ts +4 -7
  55. package/types/core/compile/compile.d.ts +6 -6
  56. package/types/core/controller/controller.d.ts +0 -5
  57. package/types/core/di/internal-injector.d.ts +73 -18
  58. package/types/core/exception-handler.d.ts +1 -1
  59. package/types/core/interval/interval-factory.d.ts +1 -1
  60. package/types/core/interval/interval.d.ts +4 -0
  61. package/types/core/location/location.d.ts +235 -166
  62. package/types/core/parser/parse.d.ts +1 -1
  63. package/types/core/q/q.d.ts +61 -40
  64. package/types/core/scope/scope.d.ts +5 -8
  65. package/types/core/timeout/timeout.d.ts +16 -26
  66. package/types/core/url-utils/url-utils.d.ts +4 -0
  67. package/types/directive/input/input.d.ts +19 -124
  68. package/types/directive/select/select.d.ts +7 -74
  69. package/types/directive/show-hide/show-hide.d.ts +11 -224
  70. package/types/loader.d.ts +4 -4
  71. package/types/router/params/param.d.ts +11 -0
  72. package/types/router/state/state-builder.d.ts +1 -2
  73. package/types/router/state/state-service.d.ts +2 -2
  74. package/types/router/state-provider.d.ts +2 -2
  75. package/types/router/template-factory.d.ts +15 -15
  76. package/types/router/url/url-service.d.ts +12 -12
  77. package/types/services/anchor-scroll.d.ts +1 -1
  78. package/types/services/browser.d.ts +0 -10
  79. package/types/services/cache-factory.d.ts +0 -67
  80. package/types/services/cookie-reader.d.ts +2 -10
  81. package/types/services/http/http.d.ts +53 -61
  82. package/types/services/http-backend/http-backend.d.ts +8 -31
  83. package/types/services/template-request.d.ts +1 -9
  84. package/types/shared/jqlite/jqlite.d.ts +11 -11
  85. package/types/types.d.ts +1 -9
package/src/types.js CHANGED
@@ -11,12 +11,10 @@
11
11
  */
12
12
 
13
13
  /**
14
- *
15
14
  * @typedef {Object} Annotated
16
15
  * @property {Array<String>} $inject
17
- * *
18
- * @typedef {Function & Annotated & Array<any>} AnnotatedFunction
19
16
  *
17
+ * @typedef {Function & Annotated & Array<any>} AnnotatedFunction
20
18
  */
21
19
 
22
20
  /**
@@ -316,7 +314,7 @@
316
314
 
317
315
  /**
318
316
  * Interface for a service provider.
319
- * @typedef {Object} ServiceProvider
317
+ * @typedef {Object|Function} ServiceProvider
320
318
  * @property {*} $get - The $get property that represents a service instance or a factory function.
321
319
  */
322
320
 
@@ -1,10 +1,7 @@
1
- export function ngAnimateSwapDirective($animate: any): {
2
- restrict: string;
3
- transclude: string;
4
- terminal: boolean;
5
- priority: number;
6
- link(scope: any, $element: any, attrs: any, ctrl: any, $transclude: any): void;
7
- };
1
+ /**
2
+ * @returns {import('../types').Directive}
3
+ */
4
+ export function ngAnimateSwapDirective($animate: any): import("../types").Directive;
8
5
  export namespace ngAnimateSwapDirective {
9
6
  let $inject: string[];
10
7
  }
@@ -14,9 +14,9 @@ export class $CompileProvider {
14
14
  * are the factories.
15
15
  * @param {Function|Array} directiveFactory An injectable directive factory function. See the
16
16
  * {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
17
- * @returns {ng.ICompileProvider} Self for chaining.
17
+ * @returns {$CompileProvider} Self for chaining.
18
18
  */
19
- directive: (name: string | any, directiveFactory: Function | any[]) => ng.ICompileProvider;
19
+ directive: (name: string | any, directiveFactory: Function | any[]) => $CompileProvider;
20
20
  /**
21
21
  * @ngdoc method
22
22
  * @name $compileProvider#component
@@ -122,10 +122,10 @@ export class $CompileProvider {
122
122
  * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
123
123
  *
124
124
  * @param {RegExp=} regexp New regexp to trust urls with.
125
- * @returns {RegExp|ng.ICompileProvider} Current RegExp if called without value or self for
125
+ * @returns {RegExp|$CompileProvider} Current RegExp if called without value or self for
126
126
  * chaining otherwise.
127
127
  */
128
- aHrefSanitizationTrustedUrlList: (regexp?: RegExp | undefined) => RegExp | ng.ICompileProvider;
128
+ aHrefSanitizationTrustedUrlList: (regexp?: RegExp | undefined) => RegExp | $CompileProvider;
129
129
  /**
130
130
  * @ngdoc method
131
131
  * @name $compileProvider#imgSrcSanitizationTrustedUrlList
@@ -143,10 +143,10 @@ export class $CompileProvider {
143
143
  * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
144
144
  *
145
145
  * @param {RegExp=} regexp New regexp to trust urls with.
146
- * @returns {RegExp|ng.ICompileProvider} Current RegExp if called without value or self for
146
+ * @returns {RegExp|$CompileProvider} Current RegExp if called without value or self for
147
147
  * chaining otherwise.
148
148
  */
149
- imgSrcSanitizationTrustedUrlList: (regexp?: RegExp | undefined) => RegExp | ng.ICompileProvider;
149
+ imgSrcSanitizationTrustedUrlList: (regexp?: RegExp | undefined) => RegExp | $CompileProvider;
150
150
  strictComponentBindingsEnabled: (enabled: any) => boolean | this;
151
151
  /**
152
152
  * @ngdoc method
@@ -1,10 +1,5 @@
1
1
  export function identifierForController(controller: any, ident: any): any;
2
2
  /**
3
- * @ngdoc provider
4
- * @name $controllerProvider
5
- *
6
- *
7
- * @description
8
3
  * The {@link ng.$controller $controller service} is used by AngularJS to create new
9
4
  * controllers.
10
5
  *
@@ -1,36 +1,91 @@
1
- export class ProviderInjector {
1
+ /**
2
+ * Injector for providers
3
+ * @extends AbstractInjector
4
+ */
5
+ export class ProviderInjector extends AbstractInjector {
2
6
  /**
3
- *
4
7
  * @param {Object} cache
5
- * @param {boolean} strictDi
8
+ * @param {boolean} strictDi - Indicates if strict dependency injection is enforced.
6
9
  */
7
10
  constructor(cache: any, strictDi: boolean);
11
+ }
12
+ /**
13
+ * Injector for factories and services
14
+ * @extends AbstractInjector
15
+ */
16
+ export class InjectorService extends AbstractInjector {
17
+ /**
18
+ *
19
+ * @param {boolean} strictDi - Indicates if strict dependency injection is enforced.
20
+ * @param {ProviderInjector} providerInjector
21
+ */
22
+ constructor(strictDi: boolean, providerInjector: ProviderInjector);
23
+ providerInjector: ProviderInjector;
24
+ factory(serviceName: any): any;
25
+ /**
26
+ *
27
+ * @param {String} name
28
+ * @returns {boolean}
29
+ */
30
+ has(name: string): boolean;
31
+ }
32
+ declare class AbstractInjector {
33
+ /**
34
+ * @param {boolean} strictDi - Indicates if strict dependency injection is enforced.
35
+ */
36
+ constructor(strictDi: boolean);
37
+ /**
38
+ * @type {Object<String, Function>}
39
+ */
8
40
  cache: any;
41
+ /** @type {boolean} */
9
42
  strictDi: boolean;
10
43
  path: any[];
11
- providerCache: any;
12
- modules: any;
13
- factory(caller: any): void;
44
+ /** @type {Object.<string, import("../../types").Module>} */
45
+ modules: {
46
+ [x: string]: import("../../types").Module;
47
+ };
14
48
  /**
49
+ * Get a service by name.
15
50
  *
16
51
  * @param {String} serviceName
17
52
  * @returns {any}
18
53
  */
19
54
  get(serviceName: string): any;
20
- injectionArgs(fn: any, locals: any, serviceName: any): any[];
21
- invoke(fn: any, self: any, locals: any, serviceName: any): any;
22
- instantiate(Type: any, locals: any, serviceName: any): any;
23
55
  /**
56
+ * Get the injection arguments for a function.
24
57
  *
25
- * @param {String} name
26
- * @returns {boolean}
58
+ * @param {Function|Array} fn
59
+ * @param {Object} locals
60
+ * @param {String} serviceName
61
+ * @returns
62
+ */
63
+ injectionArgs(fn: Function | any[], locals: any, serviceName: string): any[];
64
+ /**
65
+ * Invoke a function with optional context and locals.
66
+ *
67
+ * @param {Function|String|Array<any>} fn
68
+ * @param {*} [self]
69
+ * @param {Object} [locals]
70
+ * @param {String} [serviceName]
71
+ * @returns
72
+ */
73
+ invoke(fn: Function | string | Array<any>, self?: any, locals?: any, serviceName?: string): any;
74
+ /**
75
+ * Instantiate a type constructor with optional locals.
76
+ * @param {Function|Array} type
77
+ * @param {*} [locals]
78
+ * @param {String} [serviceName]
79
+ */
80
+ instantiate(type: Function | any[], locals?: any, serviceName?: string): any;
81
+ /**
82
+ * @abstract
27
83
  */
28
- has(name: string): boolean;
29
- }
30
- export class InjectorService extends ProviderInjector {
31
- constructor(cache: any, strictDi: any, providerInjector: any);
32
- strictDi: any;
33
- providerInjector: any;
34
- factory(serviceName: any, caller: any): any;
35
84
  loadNewModules(): void;
85
+ /**
86
+ * @abstract
87
+ * @param {String} _serviceName
88
+ */
89
+ factory(_serviceName: string): void;
36
90
  }
91
+ export {};
@@ -2,7 +2,7 @@
2
2
  * @constructor
3
3
  * @this {ExceptionHandlerProvider}
4
4
  */
5
- export function $ExceptionHandlerProvider(this: import("../types").ServiceProvider): void;
5
+ export function $ExceptionHandlerProvider(this: any): void;
6
6
  export class $ExceptionHandlerProvider {
7
7
  $get: (string | (($log: any) => ErrorHandler))[];
8
8
  }
@@ -1,4 +1,4 @@
1
1
  export function $$IntervalFactoryProvider(): void;
2
2
  export class $$IntervalFactoryProvider {
3
- $get: (string | (($browser: any, $q: any, $$q: any, $rootScope: any) => (setIntervalFn: any, clearIntervalFn: any) => (fn: any, delay: any, count: any, invokeApply: any, ...args: any[]) => any))[];
3
+ $get: (string | (($browser: import("../../services/browser").Browser, $q: any, $$q: any, $rootScope: import("../scope/scope").Scope) => (setIntervalFn: any, clearIntervalFn: any) => (fn: any, delay: any, count: any, invokeApply: any, ...args: any[]) => any))[];
4
4
  }
@@ -2,3 +2,7 @@ export function $IntervalProvider(): void;
2
2
  export class $IntervalProvider {
3
3
  $get: (string | (($$intervalFactory: any) => any))[];
4
4
  }
5
+ /**
6
+ * Interval ID which uniquely identifies the interval and can be used to cancel it
7
+ */
8
+ export type IntervalId = number;
@@ -1,3 +1,34 @@
1
+ export function $LocationProvider(): void;
2
+ export class $LocationProvider {
3
+ /**
4
+ * The default value for the prefix is `'!'`.
5
+ * @param {string=} prefix Prefix for hash part (containing path and search)
6
+ * @returns {*} current value if used as getter or itself (chaining) if used as setter
7
+ */
8
+ hashPrefix: (prefix?: string | undefined) => any;
9
+ /**
10
+ * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.
11
+ * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported
12
+ * properties:
13
+ * - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to
14
+ * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not
15
+ * support `pushState`.
16
+ * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies
17
+ * whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are
18
+ * true, and a base tag is not present, an error will be thrown when `$location` is injected.
19
+ * See the {@link guide/$location $location guide for more information}
20
+ * - **rewriteLinks** - `{boolean|string}` - (default: `true`) When html5Mode is enabled,
21
+ * enables/disables URL rewriting for relative links. If set to a string, URL rewriting will
22
+ * only happen on links with an attribute that matches the given string. For example, if set
23
+ * to `'internal-link'`, then the URL will only be rewritten for `<a internal-link>` links.
24
+ * Note that [attribute name normalization](guide/directive#normalization) does not apply
25
+ * here, so `'internalLink'` will **not** match `'internal-link'`.
26
+ *
27
+ * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter
28
+ */
29
+ html5Mode: (mode?: (boolean | any) | undefined) => any;
30
+ $get: (string | (($rootScope: import("../scope/scope").Scope, $browser: import("../../services/browser").Browser, $rootElement: JQLite) => Location))[];
31
+ }
1
32
  /**
2
33
  *
3
34
  * @param {string} base
@@ -10,201 +41,239 @@ export function stripHash(url: any): any;
10
41
  export function stripFile(url: any): any;
11
42
  export function serverBase(url: any): any;
12
43
  /**
13
- * LocationHtml5Url represents a URL
14
- * This object is exposed as $location service when HTML5 mode is enabled and supported
15
- *
16
- * @constructor
17
- * @param {string} appBase application base URL
18
- * @param {string} appBaseNoFile application base URL stripped of any filename
19
- * @param {string} basePrefix URL path prefix
44
+ * @abstract
20
45
  */
21
- export function LocationHtml5Url(appBase: string, appBaseNoFile: string, basePrefix: string): void;
22
- export class LocationHtml5Url {
46
+ export class Location {
23
47
  /**
24
- * LocationHtml5Url represents a URL
25
- * This object is exposed as $location service when HTML5 mode is enabled and supported
26
- *
27
- * @constructor
28
48
  * @param {string} appBase application base URL
29
49
  * @param {string} appBaseNoFile application base URL stripped of any filename
30
- * @param {string} basePrefix URL path prefix
31
50
  */
32
- constructor(appBase: string, appBaseNoFile: string, basePrefix: string);
51
+ constructor(appBase: string, appBaseNoFile: string);
52
+ /** @type {string} */
53
+ appBase: string;
54
+ /** @type {string} */
55
+ appBaseNoFile: string;
56
+ /**
57
+ * An absolute URL is the full URL, including protocol (http/https ), the optional subdomain (e.g. www ), domain (example.com), and path (which includes the directory and slug).
58
+ * @type {string}
59
+ */
60
+ $$absUrl: string;
61
+ /**
62
+ * If html5 mode is enabled
63
+ * @type {boolean}
64
+ */
33
65
  $$html5: boolean;
34
66
  /**
35
- * Parse given HTML5 (regular) URL string into properties
36
- * @param {string} url HTML5 URL
37
- * @private
67
+ * Has any change been replacing?
68
+ * @type {boolean}
38
69
  */
39
- private $$parse;
40
- $$normalizeUrl: (url: any) => string;
41
- $$parseLinkUrl: (url: any, relHref: any) => boolean;
42
- }
43
- /**
44
- * LocationHashbangUrl represents URL
45
- * This object is exposed as $location service when developer doesn't opt into html5 mode.
46
- * It also serves as the base class for html5 mode fallback on legacy browsers.
47
- *
48
- * @constructor
49
- * @param {string} appBase application base URL
50
- * @param {string} appBaseNoFile application base URL stripped of any filename
51
- * @param {string} hashPrefix hashbang prefix
52
- */
53
- export function LocationHashbangUrl(appBase: string, appBaseNoFile: string, hashPrefix: string): void;
54
- export class LocationHashbangUrl {
70
+ $$replace: boolean;
71
+ /** @type {import('../url-utils/url-utils').HttpProtocol} */
72
+ $$protocol: import("../url-utils/url-utils").HttpProtocol;
73
+ /** @type {string} */
74
+ $$host: string;
55
75
  /**
56
- * LocationHashbangUrl represents URL
57
- * This object is exposed as $location service when developer doesn't opt into html5 mode.
58
- * It also serves as the base class for html5 mode fallback on legacy browsers.
76
+ * The port, without ":"
77
+ * @type {number}
78
+ */
79
+ $$port: number;
80
+ /**
81
+ * The pathname, beginning with "/"
82
+ * @type {string}
83
+ */
84
+ $$path: string;
85
+ /**
86
+ * The hash string, minus the hash symbol
87
+ * @type {string}
88
+ */
89
+ $$hash: string;
90
+ /**
91
+ * Helper property for scope watch changes
92
+ * @type {boolean}
93
+ */
94
+ $$urlUpdatedByLocation: boolean;
95
+ /**
96
+ * Return full URL representation with all segments encoded according to rules specified in
97
+ * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
59
98
  *
60
- * @constructor
61
- * @param {string} appBase application base URL
62
- * @param {string} appBaseNoFile application base URL stripped of any filename
63
- * @param {string} hashPrefix hashbang prefix
99
+ * @return {string} full URL
64
100
  */
65
- constructor(appBase: string, appBaseNoFile: string, hashPrefix: string);
101
+ absUrl(): string;
66
102
  /**
67
- * Parse given hashbang URL into properties
68
- * @param {string} url Hashbang URL
69
- * @private
103
+ * This method is getter / setter.
104
+ *
105
+ * Return URL (e.g. `/path?a=b#hash`) when called without any parameter.
106
+ * Change path, search and hash, when called with parameter and return `$location`.
107
+ *
108
+ * @param {string=} url New URL without base prefix (e.g. `/path?a=b#hash`)
109
+ * @return {Location|string} url
70
110
  */
71
- private $$parse;
72
- $$normalizeUrl: (url: any) => string;
73
- $$parseLinkUrl: (url: any) => boolean;
74
- }
75
- /**
76
- * LocationHashbangUrl represents URL
77
- * This object is exposed as $location service when html5 history api is enabled but the browser
78
- * does not support it.
79
- *
80
- * @constructor
81
- * @param {string} appBase application base URL
82
- * @param {string} appBaseNoFile application base URL stripped of any filename
83
- * @param {string} hashPrefix hashbang prefix
84
- */
85
- export function LocationHashbangInHtml5Url(appBase: string, appBaseNoFile: string, hashPrefix: string, ...args: any[]): void;
86
- export class LocationHashbangInHtml5Url {
111
+ url(url?: string | undefined): Location | string;
87
112
  /**
88
- * LocationHashbangUrl represents URL
89
- * This object is exposed as $location service when html5 history api is enabled but the browser
90
- * does not support it.
91
113
  *
92
- * @constructor
93
- * @param {string} appBase application base URL
94
- * @param {string} appBaseNoFile application base URL stripped of any filename
95
- * @param {string} hashPrefix hashbang prefix
114
+ * Return protocol of current URL.
115
+ * @return {import("../url-utils/url-utils").HttpProtocol} protocol of current URL
96
116
  */
97
- constructor(appBase: string, appBaseNoFile: string, hashPrefix: string, ...args: any[]);
98
- $$html5: boolean;
99
- $$parseLinkUrl: (url: any, relHref: any) => boolean;
100
- $$normalizeUrl: (url: any) => string;
101
- }
102
- /**
103
- * @ngdoc service
104
- * @name $location
105
- *
106
- * @requires $rootElement
107
- *
108
- * @description
109
- * The $location service parses the URL in the browser address bar (based on the
110
- * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL
111
- * available to your application. Changes to the URL in the address bar are reflected into
112
- * $location service and changes to $location are reflected into the browser address bar.
113
- *
114
- * **The $location service:**
115
- *
116
- * - Exposes the current URL in the browser address bar, so you can
117
- * - Watch and observe the URL.
118
- * - Change the URL.
119
- * - Synchronizes the URL with the browser when the user
120
- * - Changes the address bar.
121
- * - Clicks the back or forward button (or clicks a History link).
122
- * - Clicks on a link.
123
- * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
124
- *
125
- * For more information see {@link guide/$location Developer Guide: Using $location}
126
- */
127
- /**
128
- * @ngdoc provider
129
- * @name $locationProvider
130
- *
131
- *
132
- * @description
133
- * Use the `$locationProvider` to configure how the application deep linking paths are stored.
134
- */
135
- export function $LocationProvider(): void;
136
- export class $LocationProvider {
117
+ protocol(): import("../url-utils/url-utils").HttpProtocol;
137
118
  /**
138
- * @ngdoc method
139
- * @name $locationProvider#hashPrefix
140
- * @description
141
- * The default value for the prefix is `'!'`.
142
- * @param {string=} prefix Prefix for hash part (containing path and search)
143
- * @returns {*} current value if used as getter or itself (chaining) if used as setter
119
+ * This method is getter only.
120
+ *
121
+ * Return host of current URL.
122
+ *
123
+ * Note: compared to the non-AngularJS version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.
124
+ *
125
+ *
126
+ * @return {string} host of current URL.
144
127
  */
145
- hashPrefix: (prefix?: string | undefined) => any;
128
+ host(): string;
146
129
  /**
147
- * @ngdoc method
148
- * @name $locationProvider#html5Mode
149
- * @description
150
- * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.
151
- * If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported
152
- * properties:
153
- * - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to
154
- * change urls where supported. Will fall back to hash-prefixed paths in browsers that do not
155
- * support `pushState`.
156
- * - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies
157
- * whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are
158
- * true, and a base tag is not present, an error will be thrown when `$location` is injected.
159
- * See the {@link guide/$location $location guide for more information}
160
- * - **rewriteLinks** - `{boolean|string}` - (default: `true`) When html5Mode is enabled,
161
- * enables/disables URL rewriting for relative links. If set to a string, URL rewriting will
162
- * only happen on links with an attribute that matches the given string. For example, if set
163
- * to `'internal-link'`, then the URL will only be rewritten for `<a internal-link>` links.
164
- * Note that [attribute name normalization](guide/directive#normalization) does not apply
165
- * here, so `'internalLink'` will **not** match `'internal-link'`.
130
+ * This method is getter only.
166
131
  *
167
- * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter
132
+ * Return port of current URL.
133
+ *
134
+ *
135
+ * ```js
136
+ * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
137
+ * let port = $location.port();
138
+ * // => 80
139
+ * ```
140
+ *
141
+ * @return {number} port
168
142
  */
169
- html5Mode: (mode?: (boolean | any) | undefined) => any;
143
+ port(): number;
144
+ /**
145
+ * This method is getter / setter.
146
+ *
147
+ * Return path of current URL when called without any parameter.
148
+ *
149
+ * Change path when called with parameter and return `$location`.
150
+ *
151
+ * Note: Path should always begin with forward slash (/), this method will add the forward slash
152
+ * if it is missing.
153
+ *
154
+ *
155
+ * ```js
156
+ * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
157
+ * let path = $location.path();
158
+ * // => "/some/path"
159
+ * ```
160
+ *
161
+ * @param {(string|number)=} path New path
162
+ * @return {(string|object)} path if called with no parameters, or `$location` if called with a parameter
163
+ */
164
+ path(path?: (string | number) | undefined): (string | object);
170
165
  /**
171
- * @ngdoc event
172
- * @name $location#$locationChangeStart
173
- * @eventType broadcast on root scope
174
- * @description
175
- * Broadcasted before a URL will change.
166
+ * This method is getter / setter.
167
+ *
168
+ * Returns the hash fragment when called without any parameters.
169
+ *
170
+ * Changes the hash fragment when called with a parameter and returns `$location`.
176
171
  *
177
- * This change can be prevented by calling
178
- * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more
179
- * details about event object. Upon successful change
180
- * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.
181
172
  *
182
- * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
183
- * the browser supports the HTML5 History API.
173
+ * ```js
174
+ * // given URL http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
175
+ * let hash = $location.hash();
176
+ * // => "hashValue"
177
+ * ```
184
178
  *
185
- * @param {Object} angularEvent Synthetic event object.
186
- * @param {string} newUrl New URL
187
- * @param {string=} oldUrl URL that was before it was changed.
188
- * @param {string=} newState New history state object
189
- * @param {string=} oldState History state object that was before it was changed.
179
+ * @param {(string|number)=} hash New hash fragment
180
+ * @return {string|Location} hash
181
+ */
182
+ hash(hash?: (string | number) | undefined): string | Location;
183
+ /**
184
+ * If called, all changes to $location during the current `$digest` will replace the current history
185
+ * record, instead of adding a new one.
186
+ */
187
+ replace(): this;
188
+ /**
189
+ * Returns or sets the search part (as object) of current URL when called without any parameter
190
+ *
191
+ * @param {string|Object=} search New search params - string or hash object.
192
+ * @param {(string|number|Array<string>|boolean)=} paramValue If search is a string or number, then paramValue will override only a single search property.
193
+ * @returns {Object|Location} Search object or Location object
194
+ */
195
+ search(search?: (string | any) | undefined, paramValue?: (string | number | Array<string> | boolean) | undefined, ...args: any[]): any | Location;
196
+ $$search: any;
197
+ /**
198
+ * Compose url and update `url` and `absUrl` property
199
+ * @returns {void}
200
+ */
201
+ $$compose(): void;
202
+ $$url: string;
203
+ /**
204
+ * @param {string} _url
205
+ * @returns {string}
190
206
  */
207
+ $$normalizeUrl(_url: string): string;
191
208
  /**
192
- * @ngdoc event
193
- * @name $location#$locationChangeSuccess
194
- * @eventType broadcast on root scope
195
- * @description
196
- * Broadcasted after a URL was changed.
209
+ * This method is getter / setter.
210
+ *
211
+ * Return the history state object when called without any parameter.
212
+ *
213
+ * Change the history state object when called with one parameter and return `$location`.
214
+ * The state object is later passed to `pushState` or `replaceState`.
215
+ * See {@link https://developer.mozilla.org/en-US/docs/Web/API/History/pushState#state|History.state}
197
216
  *
198
- * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
199
- * the browser supports the HTML5 History API.
217
+ * NOTE: This method is supported only in HTML5 mode and only in browsers supporting
218
+ * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support
219
+ * older browsers (like IE9 or Android < 4.0), don't use this method.
200
220
  *
201
- * @param {Object} angularEvent Synthetic event object.
202
- * @param {string} newUrl New URL
203
- * @param {string=} oldUrl URL that was before it was changed.
204
- * @param {string=} newState New history state object
205
- * @param {string=} oldState History state object that was before it was changed.
221
+ * @param {any} state State object for pushState or replaceState
222
+ * @return {any} state
223
+ */
224
+ state(state: any, ...args: any[]): any;
225
+ $$state: any;
226
+ }
227
+ /**
228
+ * This object is exposed as $location service when HTML5 mode is enabled and supported
229
+ */
230
+ export class LocationHtml5Url extends Location {
231
+ /**
232
+ * @param {string} appBase application base URL
233
+ * @param {string} appBaseNoFile application base URL stripped of any filename
234
+ * @param {string} basePrefix URL path prefix
235
+ */
236
+ constructor(appBase: string, appBaseNoFile: string, basePrefix: string);
237
+ basePrefix: string;
238
+ /**
239
+ * Parse given HTML5 (regular) URL string into properties
240
+ * @param {string} url HTML5 URL
241
+ */
242
+ $$parse(url: string): void;
243
+ $$normalizeUrl(url: any): string;
244
+ $$parseLinkUrl: (url: any, relHref: any) => boolean;
245
+ }
246
+ /**
247
+ * LocationHashbangUrl represents URL
248
+ * This object is exposed as $location service when developer doesn't opt into html5 mode.
249
+ * It also serves as the base class for html5 mode fallback on legacy browsers.
250
+ *
251
+ * @constructor
252
+ * @param {string} appBase application base URL
253
+ * @param {string} appBaseNoFile application base URL stripped of any filename
254
+ * @param {string} hashPrefix hashbang prefix
255
+ */
256
+ export class LocationHashbangUrl extends Location {
257
+ constructor(appBase: any, appBaseNoFile: any, hashPrefix: any);
258
+ appBase: any;
259
+ appBaseNoFile: any;
260
+ hashPrefix: any;
261
+ /**
262
+ * Parse given hashbang URL into properties
263
+ * @param {string} url Hashbang URL
206
264
  */
207
- $get: (string | (($rootScope: any, $browser: any, $rootElement: JQLite) => LocationHtml5Url | LocationHashbangUrl))[];
265
+ $$parse(url: string): void;
266
+ $$normalizeUrl(url: any): any;
267
+ $$parseLinkUrl(url: any): boolean;
208
268
  }
209
- export const PATH_MATCH: RegExp;
269
+ export type DefaultPorts = {
270
+ http: number;
271
+ https: number;
272
+ ftp: number;
273
+ };
274
+ export type Html5Mode = {
275
+ enabled: boolean;
276
+ requireBase: boolean;
277
+ rewriteLinks: boolean | string;
278
+ };
210
279
  import { JQLite } from "../../shared/jqlite/jqlite";