@angular-wave/angular.ts 0.0.66 → 0.0.67
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/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/animations/animate-js.js +4 -4
- package/src/animations/animate-swap.js +3 -0
- package/src/core/compile/compile.js +3 -3
- package/src/core/controller/controller.js +0 -5
- package/src/core/di/injector.js +9 -12
- package/src/core/di/internal-injector.js +113 -60
- package/src/core/parser/parse.js +1 -12
- package/src/core/parser/parse.spec.js +96 -110
- package/src/core/timeout/timeout.js +110 -111
- package/src/directive/input/input.js +32 -726
- package/src/directive/input/input.md +706 -0
- package/src/directive/select/select.js +48 -122
- package/src/directive/select/select.md +74 -0
- package/src/directive/show-hide/show-hide.js +13 -224
- package/src/directive/show-hide/show-hide.md +257 -0
- package/src/filters/limit-to.spec.js +1 -1
- package/src/filters/order-by.spec.js +1 -1
- package/src/index.js +6 -2
- package/src/loader.js +7 -3
- package/src/public.js +1 -7
- package/src/router/state/state-builder.js +2 -4
- package/src/router/state/state-service.js +1 -1
- package/src/router/state-provider.js +1 -1
- package/src/router/template-factory.js +10 -10
- package/src/router/url/url-service.js +4 -4
- package/src/services/anchor-scroll.js +2 -2
- package/src/services/browser.js +2 -9
- package/src/services/cache-factory.js +0 -67
- package/src/services/cache-factory.md +75 -0
- package/src/services/cookie-reader.js +36 -55
- package/src/services/http/http.js +62 -587
- package/src/services/http/http.md +413 -0
- package/src/services/http-backend/http-backend.js +19 -44
- package/src/services/template-request.js +1 -9
- package/src/shared/jqlite/jqlite.js +4 -69
- package/src/types.js +2 -4
- package/types/animations/animate-swap.d.ts +4 -7
- package/types/core/compile/compile.d.ts +6 -6
- package/types/core/controller/controller.d.ts +0 -5
- package/types/core/di/internal-injector.d.ts +73 -18
- package/types/core/exception-handler.d.ts +1 -1
- package/types/core/parser/parse.d.ts +1 -1
- package/types/core/timeout/timeout.d.ts +16 -26
- package/types/directive/input/input.d.ts +19 -124
- package/types/directive/select/select.d.ts +7 -74
- package/types/directive/show-hide/show-hide.d.ts +11 -224
- package/types/loader.d.ts +4 -4
- package/types/router/state/state-builder.d.ts +1 -2
- package/types/router/state/state-service.d.ts +2 -2
- package/types/router/state-provider.d.ts +2 -2
- package/types/router/template-factory.d.ts +15 -15
- package/types/router/url/url-service.d.ts +4 -4
- package/types/services/anchor-scroll.d.ts +1 -1
- package/types/services/browser.d.ts +0 -10
- package/types/services/cache-factory.d.ts +0 -67
- package/types/services/cookie-reader.d.ts +2 -10
- package/types/services/http/http.d.ts +53 -61
- package/types/services/http-backend/http-backend.d.ts +8 -31
- package/types/services/template-request.d.ts +1 -9
- package/types/shared/jqlite/jqlite.d.ts +9 -9
- package/types/types.d.ts +1 -9
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
/\*\*
|
|
2
|
+
|
|
3
|
+
- @ngdoc directive
|
|
4
|
+
- @name ngShow
|
|
5
|
+
- @multiElement
|
|
6
|
+
-
|
|
7
|
+
- @description
|
|
8
|
+
- The `ngShow` directive shows or hides the given HTML element based on the expression provided to
|
|
9
|
+
- the `ngShow` attribute.
|
|
10
|
+
-
|
|
11
|
+
- The element is shown or hidden by removing or adding the `.ng-hide` CSS class onto the element.
|
|
12
|
+
- The `.ng-hide` CSS class is predefined in AngularJS and sets the display style to none (using an
|
|
13
|
+
- `!important` flag). For CSP mode please add `angular-csp.css` to your HTML file (see
|
|
14
|
+
- {@link ng.directive:ngCsp ngCsp}).
|
|
15
|
+
-
|
|
16
|
+
- ```html
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- <!-- when $scope.myValue is truthy (element is visible) -->
|
|
21
|
+
- <div ng-show="myValue"></div>
|
|
22
|
+
-
|
|
23
|
+
- <!-- when $scope.myValue is falsy (element is hidden) -->
|
|
24
|
+
- <div ng-show="myValue" class="ng-hide"></div>
|
|
25
|
+
- ```
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
-
|
|
30
|
+
- When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added
|
|
31
|
+
- to the class attribute on the element causing it to become hidden. When truthy, the `.ng-hide`
|
|
32
|
+
- CSS class is removed from the element causing the element not to appear hidden.
|
|
33
|
+
-
|
|
34
|
+
- ## Why is `!important` used?
|
|
35
|
+
-
|
|
36
|
+
- You may be wondering why `!important` is used for the `.ng-hide` CSS class. This is because the
|
|
37
|
+
- `.ng-hide` selector can be easily overridden by heavier selectors. For example, something as
|
|
38
|
+
- simple as changing the display style on a HTML list item would make hidden elements appear
|
|
39
|
+
- visible. This also becomes a bigger issue when dealing with CSS frameworks.
|
|
40
|
+
-
|
|
41
|
+
- By using `!important`, the show and hide behavior will work as expected despite any clash between
|
|
42
|
+
- CSS selector specificity (when `!important` isn't used with any conflicting styles). If a
|
|
43
|
+
- developer chooses to override the styling to change how to hide an element then it is just a
|
|
44
|
+
- matter of using `!important` in their own CSS code.
|
|
45
|
+
-
|
|
46
|
+
- ### Overriding `.ng-hide`
|
|
47
|
+
-
|
|
48
|
+
- By default, the `.ng-hide` class will style the element with `display: none !important`. If you
|
|
49
|
+
- wish to change the hide behavior with `ngShow`/`ngHide`, you can simply overwrite the styles for
|
|
50
|
+
- the `.ng-hide` CSS class. Note that the selector that needs to be used is actually
|
|
51
|
+
- `.ng-hide:not(.ng-hide-animate)` to cope with extra animation classes that can be added.
|
|
52
|
+
-
|
|
53
|
+
- ```css
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- .ng-hide:not(.ng-hide-animate) {
|
|
58
|
+
- /\* These are just alternative ways of hiding an element \*/
|
|
59
|
+
- display: block!important;
|
|
60
|
+
- position: absolute;
|
|
61
|
+
- top: -9999px;
|
|
62
|
+
- left: -9999px;
|
|
63
|
+
- }
|
|
64
|
+
- ```
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
-
|
|
69
|
+
- By default you don't need to override anything in CSS and the animations will work around the
|
|
70
|
+
- display style.
|
|
71
|
+
-
|
|
72
|
+
- @animations
|
|
73
|
+
- | Animation | Occurs |
|
|
74
|
+
- |-----------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
|
|
75
|
+
- | {@link $animate#addClass addClass} `.ng-hide` | After the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden. |
|
|
76
|
+
- | {@link $animate#removeClass removeClass} `.ng-hide` | After the `ngShow` expression evaluates to a truthy value and just before contents are set to visible. |
|
|
77
|
+
-
|
|
78
|
+
- Animations in `ngShow`/`ngHide` work with the show and hide events that are triggered when the
|
|
79
|
+
- directive expression is true and false. This system works like the animation system present with
|
|
80
|
+
- `ngClass` except that you must also include the `!important` flag to override the display
|
|
81
|
+
- property so that the elements are not actually hidden during the animation.
|
|
82
|
+
-
|
|
83
|
+
- ```css
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
- /\* A working example can be found at the bottom of this page. \*/
|
|
88
|
+
- .my-element.ng-hide-add, .my-element.ng-hide-remove {
|
|
89
|
+
- transition: all 0.5s linear;
|
|
90
|
+
- }
|
|
91
|
+
-
|
|
92
|
+
- .my-element.ng-hide-add { ... }
|
|
93
|
+
- .my-element.ng-hide-add.ng-hide-add-active { ... }
|
|
94
|
+
- .my-element.ng-hide-remove { ... }
|
|
95
|
+
- .my-element.ng-hide-remove.ng-hide-remove-active { ... }
|
|
96
|
+
- ```
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
-
|
|
101
|
+
- Keep in mind that, as of AngularJS version 1.3, there is no need to change the display property
|
|
102
|
+
- to block during animation states - ngAnimate will automatically handle the style toggling for you.
|
|
103
|
+
-
|
|
104
|
+
- @element ANY
|
|
105
|
+
- @param {string} ngShow If the {@link guide/expression expression} is truthy/falsy then the
|
|
106
|
+
- element is shown/hidden respectively.
|
|
107
|
+
-
|
|
108
|
+
- @example
|
|
109
|
+
- A simple example, animating the element's opacity:
|
|
110
|
+
|
|
111
|
+
- <hr />
|
|
112
|
+
-
|
|
113
|
+
- @knownIssue
|
|
114
|
+
-
|
|
115
|
+
- ### Flickering when using ngShow to toggle between elements
|
|
116
|
+
-
|
|
117
|
+
- When using {@link ngShow} and / or {@link ngHide} to toggle between elements, it can
|
|
118
|
+
- happen that both the element to show and the element to hide are visible for a very short time.
|
|
119
|
+
-
|
|
120
|
+
- This usually happens when the {@link ngAnimate ngAnimate module} is included, but no actual animations
|
|
121
|
+
- are defined for {@link ngShow} / {@link ngHide}.
|
|
122
|
+
-
|
|
123
|
+
- There are several way to mitigate this problem:
|
|
124
|
+
-
|
|
125
|
+
- - {@link guide/animations#how-to-selectively-enable-disable-and-skip-animations Disable animations on the affected elements}.
|
|
126
|
+
- - Use {@link ngIf} or {@link ngSwitch} instead of {@link ngShow} / {@link ngHide}.
|
|
127
|
+
- - Use the special CSS selector `ng-hide.ng-hide-animate` to set `{display: none}` or similar on the affected elements.
|
|
128
|
+
- - Use `ng-class="{'ng-hide': expression}` instead of instead of {@link ngShow} / {@link ngHide}.
|
|
129
|
+
- - Define an animation on the affected elements.
|
|
130
|
+
\*/
|
|
131
|
+
|
|
132
|
+
/\*\*
|
|
133
|
+
|
|
134
|
+
- @ngdoc directive
|
|
135
|
+
- @name ngHide
|
|
136
|
+
- @multiElement
|
|
137
|
+
-
|
|
138
|
+
- @description
|
|
139
|
+
- The `ngHide` directive shows or hides the given HTML element based on the expression provided to
|
|
140
|
+
- the `ngHide` attribute.
|
|
141
|
+
-
|
|
142
|
+
- The element is shown or hidden by removing or adding the `.ng-hide` CSS class onto the element.
|
|
143
|
+
- The `.ng-hide` CSS class is predefined in AngularJS and sets the display style to none (using an
|
|
144
|
+
- `!important` flag). For CSP mode please add `angular-csp.css` to your HTML file (see
|
|
145
|
+
- {@link ng.directive:ngCsp ngCsp}).
|
|
146
|
+
-
|
|
147
|
+
- ```html
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
- <!-- when $scope.myValue is truthy (element is hidden) -->
|
|
152
|
+
- <div ng-hide="myValue" class="ng-hide"></div>
|
|
153
|
+
-
|
|
154
|
+
- <!-- when $scope.myValue is falsy (element is visible) -->
|
|
155
|
+
- <div ng-hide="myValue"></div>
|
|
156
|
+
- ```
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
-
|
|
161
|
+
- When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added
|
|
162
|
+
- to the class attribute on the element causing it to become hidden. When falsy, the `.ng-hide`
|
|
163
|
+
- CSS class is removed from the element causing the element not to appear hidden.
|
|
164
|
+
-
|
|
165
|
+
- ## Why is `!important` used?
|
|
166
|
+
-
|
|
167
|
+
- You may be wondering why `!important` is used for the `.ng-hide` CSS class. This is because the
|
|
168
|
+
- `.ng-hide` selector can be easily overridden by heavier selectors. For example, something as
|
|
169
|
+
- simple as changing the display style on a HTML list item would make hidden elements appear
|
|
170
|
+
- visible. This also becomes a bigger issue when dealing with CSS frameworks.
|
|
171
|
+
-
|
|
172
|
+
- By using `!important`, the show and hide behavior will work as expected despite any clash between
|
|
173
|
+
- CSS selector specificity (when `!important` isn't used with any conflicting styles). If a
|
|
174
|
+
- developer chooses to override the styling to change how to hide an element then it is just a
|
|
175
|
+
- matter of using `!important` in their own CSS code.
|
|
176
|
+
-
|
|
177
|
+
- ### Overriding `.ng-hide`
|
|
178
|
+
-
|
|
179
|
+
- By default, the `.ng-hide` class will style the element with `display: none !important`. If you
|
|
180
|
+
- wish to change the hide behavior with `ngShow`/`ngHide`, you can simply overwrite the styles for
|
|
181
|
+
- the `.ng-hide` CSS class. Note that the selector that needs to be used is actually
|
|
182
|
+
- `.ng-hide:not(.ng-hide-animate)` to cope with extra animation classes that can be added.
|
|
183
|
+
-
|
|
184
|
+
- ```css
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
- .ng-hide:not(.ng-hide-animate) {
|
|
189
|
+
- /\* These are just alternative ways of hiding an element \*/
|
|
190
|
+
- display: block!important;
|
|
191
|
+
- position: absolute;
|
|
192
|
+
- top: -9999px;
|
|
193
|
+
- left: -9999px;
|
|
194
|
+
- }
|
|
195
|
+
- ```
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
-
|
|
200
|
+
- By default you don't need to override in CSS anything and the animations will work around the
|
|
201
|
+
- display style.
|
|
202
|
+
-
|
|
203
|
+
- @animations
|
|
204
|
+
- | Animation | Occurs |
|
|
205
|
+
- |-----------------------------------------------------|------------------------------------------------------------------------------------------------------------|
|
|
206
|
+
- | {@link $animate#addClass addClass} `.ng-hide` | After the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden. |
|
|
207
|
+
- | {@link $animate#removeClass removeClass} `.ng-hide` | After the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible. |
|
|
208
|
+
-
|
|
209
|
+
- Animations in `ngShow`/`ngHide` work with the show and hide events that are triggered when the
|
|
210
|
+
- directive expression is true and false. This system works like the animation system present with
|
|
211
|
+
- `ngClass` except that you must also include the `!important` flag to override the display
|
|
212
|
+
- property so that the elements are not actually hidden during the animation.
|
|
213
|
+
-
|
|
214
|
+
- ```css
|
|
215
|
+
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
- /\* A working example can be found at the bottom of this page. \*/
|
|
219
|
+
- .my-element.ng-hide-add, .my-element.ng-hide-remove {
|
|
220
|
+
- transition: all 0.5s linear;
|
|
221
|
+
- }
|
|
222
|
+
-
|
|
223
|
+
- .my-element.ng-hide-add { ... }
|
|
224
|
+
- .my-element.ng-hide-add.ng-hide-add-active { ... }
|
|
225
|
+
- .my-element.ng-hide-remove { ... }
|
|
226
|
+
- .my-element.ng-hide-remove.ng-hide-remove-active { ... }
|
|
227
|
+
- ```
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
-
|
|
232
|
+
- Keep in mind that, as of AngularJS version 1.3, there is no need to change the display property
|
|
233
|
+
- to block during animation states - ngAnimate will automatically handle the style toggling for you.
|
|
234
|
+
-
|
|
235
|
+
- @element ANY
|
|
236
|
+
- @param {string} ngHide If the {@link guide/expression expression} is truthy/falsy then the
|
|
237
|
+
- element is hidden/shown respectively.
|
|
238
|
+
-
|
|
239
|
+
- @knownIssue
|
|
240
|
+
-
|
|
241
|
+
- ### Flickering when using ngHide to toggle between elements
|
|
242
|
+
-
|
|
243
|
+
- When using {@link ngShow} and / or {@link ngHide} to toggle between elements, it can
|
|
244
|
+
- happen that both the element to show and the element to hide are visible for a very short time.
|
|
245
|
+
-
|
|
246
|
+
- This usually happens when the {@link ngAnimate ngAnimate module} is included, but no actual animations
|
|
247
|
+
- are defined for {@link ngShow} / {@link ngHide}. Internet Explorer is affected more often than
|
|
248
|
+
- other browsers.
|
|
249
|
+
-
|
|
250
|
+
- There are several way to mitigate this problem:
|
|
251
|
+
-
|
|
252
|
+
- - {@link guide/animations#how-to-selectively-enable-disable-and-skip-animations Disable animations on the affected elements}.
|
|
253
|
+
- - Use {@link ngIf} or {@link ngSwitch} instead of {@link ngShow} / {@link ngHide}.
|
|
254
|
+
- - Use the special CSS selector `ng-hide.ng-hide-animate` to set `{display: none}` or similar on the affected elements.
|
|
255
|
+
- - Use `ng-class="{'ng-hide': expression}` instead of instead of {@link ngShow} / {@link ngHide}.
|
|
256
|
+
- - Define an animation on the affected elements.
|
|
257
|
+
\*/
|
package/src/index.js
CHANGED
|
@@ -3,6 +3,10 @@ import { Angular } from "./loader";
|
|
|
3
3
|
export const angular = new Angular();
|
|
4
4
|
window["angular"] = angular;
|
|
5
5
|
|
|
6
|
-
document.
|
|
6
|
+
if (document.readyState === "complete") {
|
|
7
7
|
angular.init(document);
|
|
8
|
-
}
|
|
8
|
+
} else {
|
|
9
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
10
|
+
angular.init(document);
|
|
11
|
+
});
|
|
12
|
+
}
|
package/src/loader.js
CHANGED
|
@@ -175,7 +175,7 @@ export class Angular {
|
|
|
175
175
|
*
|
|
176
176
|
* @param {any[]} modules
|
|
177
177
|
* @param {boolean?} strictDi
|
|
178
|
-
* @returns {import("./
|
|
178
|
+
* @returns {import("./core/di/internal-injector").InjectorService}
|
|
179
179
|
*/
|
|
180
180
|
injector(modules, strictDi) {
|
|
181
181
|
return createInjector(modules, strictDi);
|
|
@@ -267,7 +267,7 @@ export class Angular {
|
|
|
267
267
|
* @param {string} name The name of the module to create or retrieve.
|
|
268
268
|
* @param {Array.<string>} [requires] If specified then new module is being created. If
|
|
269
269
|
* unspecified then the module is being retrieved for further configuration.
|
|
270
|
-
* @param {Function} [configFn] Optional configuration function for the module. Same as
|
|
270
|
+
* @param {Array<any>|Function} [configFn] Optional configuration function for the module. Same as
|
|
271
271
|
* {@link import('./types').Module#config Module#config()}.
|
|
272
272
|
* @returns {NgModule} A newly registered module.
|
|
273
273
|
*/
|
|
@@ -284,7 +284,11 @@ export class Angular {
|
|
|
284
284
|
name,
|
|
285
285
|
);
|
|
286
286
|
}
|
|
287
|
-
const moduleInstance = new NgModule(
|
|
287
|
+
const moduleInstance = new NgModule(
|
|
288
|
+
name,
|
|
289
|
+
requires,
|
|
290
|
+
/** @type {Function} */ (configFn),
|
|
291
|
+
);
|
|
288
292
|
return moduleInstance;
|
|
289
293
|
});
|
|
290
294
|
}
|
package/src/public.js
CHANGED
|
@@ -59,7 +59,6 @@ import {
|
|
|
59
59
|
} from "./core/animate/animate";
|
|
60
60
|
import { BrowserProvider } from "./services/browser";
|
|
61
61
|
import { CoreAnimateCssProvider } from "./core/animate/animate-css";
|
|
62
|
-
import { CookieReaderProvider } from "./services/cookie-reader";
|
|
63
62
|
import {
|
|
64
63
|
AnimateAsyncRunFactoryProvider,
|
|
65
64
|
AnimateRunnerFactoryProvider,
|
|
@@ -79,10 +78,7 @@ import {
|
|
|
79
78
|
$HttpParamSerializerProvider,
|
|
80
79
|
$HttpParamSerializerJQLikeProvider,
|
|
81
80
|
} from "./services/http/http";
|
|
82
|
-
import {
|
|
83
|
-
$HttpBackendProvider,
|
|
84
|
-
$xhrFactoryProvider,
|
|
85
|
-
} from "./services/http-backend/http-backend";
|
|
81
|
+
import { $HttpBackendProvider } from "./services/http-backend/http-backend";
|
|
86
82
|
import { $LocationProvider } from "./core/location/location";
|
|
87
83
|
import { $LogProvider } from "./services/log";
|
|
88
84
|
import { $ParseProvider } from "./core/parser/parse";
|
|
@@ -192,7 +188,6 @@ export function publishExternalAPI(angular) {
|
|
|
192
188
|
$httpParamSerializer: $HttpParamSerializerProvider,
|
|
193
189
|
$httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,
|
|
194
190
|
$httpBackend: $HttpBackendProvider,
|
|
195
|
-
$xhrFactory: $xhrFactoryProvider,
|
|
196
191
|
$location: $LocationProvider,
|
|
197
192
|
$log: $LogProvider,
|
|
198
193
|
$parse: $ParseProvider,
|
|
@@ -205,7 +200,6 @@ export function publishExternalAPI(angular) {
|
|
|
205
200
|
$templateCache: TemplateCacheProvider,
|
|
206
201
|
$templateRequest: TemplateRequestProvider,
|
|
207
202
|
$timeout: $TimeoutProvider,
|
|
208
|
-
$$cookieReader: CookieReaderProvider,
|
|
209
203
|
});
|
|
210
204
|
},
|
|
211
205
|
],
|
|
@@ -17,9 +17,7 @@ const parseUrl = (url) => {
|
|
|
17
17
|
const root = url.charAt(0) === "^";
|
|
18
18
|
return { val: root ? url.substring(1) : url, root };
|
|
19
19
|
};
|
|
20
|
-
|
|
21
|
-
return state.name;
|
|
22
|
-
}
|
|
20
|
+
|
|
23
21
|
function selfBuilder(state) {
|
|
24
22
|
state.self.$$state = () => state;
|
|
25
23
|
return state.self;
|
|
@@ -250,7 +248,7 @@ export class StateBuilder {
|
|
|
250
248
|
return matcher.find(self.parentName(state)) || root();
|
|
251
249
|
}
|
|
252
250
|
this.builders = {
|
|
253
|
-
name: [
|
|
251
|
+
name: [(state) => state.name],
|
|
254
252
|
self: [selfBuilder],
|
|
255
253
|
parent: [parentBuilder],
|
|
256
254
|
data: [dataBuilder],
|
|
@@ -27,10 +27,10 @@ export class TemplateFactory {
|
|
|
27
27
|
"$q",
|
|
28
28
|
"$injector",
|
|
29
29
|
/**
|
|
30
|
-
* @param {
|
|
31
|
-
* @param {
|
|
32
|
-
* @param {
|
|
33
|
-
* @param {
|
|
30
|
+
* @param {any} $http
|
|
31
|
+
* @param {any} $templateCache
|
|
32
|
+
* @param {any} $templateRequest
|
|
33
|
+
* @param {any} $q
|
|
34
34
|
* @param {import("../core/di/internal-injector").InjectorService} $injector
|
|
35
35
|
* @returns
|
|
36
36
|
*/
|
|
@@ -59,9 +59,9 @@ export class TemplateFactory {
|
|
|
59
59
|
* The following properties are search in the specified order, and the first one
|
|
60
60
|
* that is defined is used to create the template:
|
|
61
61
|
*
|
|
62
|
-
* @param {
|
|
62
|
+
* @param {any} config
|
|
63
63
|
* @param {any} params Parameters to pass to the template function.
|
|
64
|
-
* @param {
|
|
64
|
+
* @param {import("./resolve/resolve-context").ResolveContext} context The resolve context associated with the template's view
|
|
65
65
|
*
|
|
66
66
|
* @return {string|object} The template html as a string, or a promise for
|
|
67
67
|
* that string,or `null` if no template is configured.
|
|
@@ -105,7 +105,7 @@ export class TemplateFactory {
|
|
|
105
105
|
* Creates a template from a string or a function returning a string.
|
|
106
106
|
*
|
|
107
107
|
* @param {string | Function} template html template as a string or function that returns an html template as a string.
|
|
108
|
-
* @param {
|
|
108
|
+
* @param {any} [params] Parameters to pass to the template function.
|
|
109
109
|
*
|
|
110
110
|
* @return {string|object} The template html as a string, or a promise for that
|
|
111
111
|
* string.
|
|
@@ -142,7 +142,7 @@ export class TemplateFactory {
|
|
|
142
142
|
*
|
|
143
143
|
* @param {import('../types').Injectable<any>} provider Function to invoke via `locals`
|
|
144
144
|
* @param {Function} injectFn a function used to invoke the template provider
|
|
145
|
-
* @param {
|
|
145
|
+
* @param {import("./resolve/resolve-context").ResolveContext} context
|
|
146
146
|
* @return {string|Promise.<string>} The template html as a string, or a promise
|
|
147
147
|
* for that string.
|
|
148
148
|
*/
|
|
@@ -173,8 +173,8 @@ export class TemplateFactory {
|
|
|
173
173
|
* It analyses the component's bindings, then constructs a template that instantiates the component.
|
|
174
174
|
* The template wires input and output bindings to resolves or from the parent component.
|
|
175
175
|
*
|
|
176
|
-
* @param {
|
|
177
|
-
* @param {
|
|
176
|
+
* @param {any} ngView {object} The parent ui-view (for binding outputs to callbacks)
|
|
177
|
+
* @param {import("./resolve/resolve-context").ResolveContext} context The ResolveContext (for binding outputs to callbacks returned from resolves)
|
|
178
178
|
* @param {string} component {string} Component's name in camel case.
|
|
179
179
|
* @param {any} [bindings] An object defining the component's bindings: {foo: '<'}
|
|
180
180
|
* @return {string} The template as a string: "<component-name input1='::$resolve.foo'></component-name>".
|
|
@@ -159,11 +159,11 @@ export class UrlService {
|
|
|
159
159
|
* locationServices.url("/some/path?query=value#anchor", true);
|
|
160
160
|
* ```
|
|
161
161
|
*
|
|
162
|
-
* @param {string} newUrl The new value for the URL.
|
|
162
|
+
* @param {string} [newUrl] The new value for the URL.
|
|
163
163
|
* This url should reflect only the new internal [[path]], [[search]], and [[hash]] values.
|
|
164
164
|
* It should not include the protocol, site, port, or base path of an absolute HREF.
|
|
165
|
-
* @param {boolean} replace When true, replaces the current history entry (instead of appending it) with this new url
|
|
166
|
-
* @param {any} state The history's state object, i.e., pushState (if the LocationServices implementation supports it)
|
|
165
|
+
* @param {boolean} [replace] When true, replaces the current history entry (instead of appending it) with this new url
|
|
166
|
+
* @param {any} [state] The history's state object, i.e., pushState (if the LocationServices implementation supports it)
|
|
167
167
|
*
|
|
168
168
|
* @return the url (after potentially being processed)
|
|
169
169
|
*/
|
|
@@ -231,7 +231,7 @@ export class UrlService {
|
|
|
231
231
|
hash: this.hash(),
|
|
232
232
|
};
|
|
233
233
|
/**
|
|
234
|
-
* @type {
|
|
234
|
+
* @type {*}
|
|
235
235
|
*/
|
|
236
236
|
const best = this.match(url);
|
|
237
237
|
const applyResult = pattern([
|
|
@@ -18,8 +18,8 @@ export function AnchorScrollProvider() {
|
|
|
18
18
|
"$rootScope",
|
|
19
19
|
/**
|
|
20
20
|
*
|
|
21
|
-
* @param {
|
|
22
|
-
* @param {
|
|
21
|
+
* @param {*} $location
|
|
22
|
+
* @param {import('../core/scope/scope').Scope} $rootScope
|
|
23
23
|
* @returns
|
|
24
24
|
*/
|
|
25
25
|
function ($location, $rootScope) {
|
package/src/services/browser.js
CHANGED
|
@@ -291,8 +291,6 @@ export function Browser(taskTracker) {
|
|
|
291
291
|
}
|
|
292
292
|
|
|
293
293
|
/**
|
|
294
|
-
* @typedef {import('../types').ServiceProvider} angular.BrowserProvider
|
|
295
|
-
* @description
|
|
296
294
|
* This object has two goals:
|
|
297
295
|
*
|
|
298
296
|
* - hide all the global state in the browser caused by the window object
|
|
@@ -300,13 +298,8 @@ export function Browser(taskTracker) {
|
|
|
300
298
|
*
|
|
301
299
|
* Remove this in the future
|
|
302
300
|
*/
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
* @constructor
|
|
306
|
-
* @this {angular.BrowserProvider}
|
|
307
|
-
*/
|
|
308
|
-
export function BrowserProvider() {
|
|
309
|
-
this.$get = [
|
|
301
|
+
export class BrowserProvider {
|
|
302
|
+
$get = [
|
|
310
303
|
"$$taskTrackerFactory",
|
|
311
304
|
/**
|
|
312
305
|
* @param {import('../core/task-tracker-factory').TaskTracker} $$taskTrackerFactory
|
|
@@ -1,72 +1,5 @@
|
|
|
1
1
|
import { extend, forEach, isUndefined, minErr } from "../shared/utils";
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @ngdoc service
|
|
5
|
-
* @name $cacheFactory
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* @description
|
|
9
|
-
* Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
|
|
10
|
-
* them.
|
|
11
|
-
*
|
|
12
|
-
* ```js
|
|
13
|
-
*
|
|
14
|
-
* let cache = $cacheFactory('cacheId');
|
|
15
|
-
* expect($cacheFactory.get('cacheId')).toBe(cache);
|
|
16
|
-
* expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
|
|
17
|
-
*
|
|
18
|
-
* cache.put("key", "value");
|
|
19
|
-
* cache.put("another key", "another value");
|
|
20
|
-
*
|
|
21
|
-
* // We've specified no options on creation
|
|
22
|
-
* expect(cache.info()).toEqual({id: 'cacheId', size: 2});
|
|
23
|
-
*
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* @example
|
|
28
|
-
<example module="cacheExampleApp" name="cache-factory">
|
|
29
|
-
<file name="index.html">
|
|
30
|
-
<div ng-controller="CacheController">
|
|
31
|
-
<input ng-model="newCacheKey" placeholder="Key">
|
|
32
|
-
<input ng-model="newCacheValue" placeholder="Value">
|
|
33
|
-
<button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
|
|
34
|
-
|
|
35
|
-
<p ng-if="keys.length">Cached Values</p>
|
|
36
|
-
<div ng-repeat="key in keys">
|
|
37
|
-
<span ng-bind="key"></span>
|
|
38
|
-
<span>: </span>
|
|
39
|
-
<b ng-bind="cache.get(key)"></b>
|
|
40
|
-
</div>
|
|
41
|
-
|
|
42
|
-
<p>Cache Info</p>
|
|
43
|
-
<div ng-repeat="(key, value) in cache.info()">
|
|
44
|
-
<span ng-bind="key"></span>
|
|
45
|
-
<span>: </span>
|
|
46
|
-
<b ng-bind="value"></b>
|
|
47
|
-
</div>
|
|
48
|
-
</div>
|
|
49
|
-
</file>
|
|
50
|
-
<file name="script.js">
|
|
51
|
-
angular.module('cacheExampleApp', []).
|
|
52
|
-
controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
|
|
53
|
-
$scope.keys = [];
|
|
54
|
-
$scope.cache = $cacheFactory('cacheId');
|
|
55
|
-
$scope.put = function(key, value) {
|
|
56
|
-
if (angular.isUndefined($scope.cache.get(key))) {
|
|
57
|
-
$scope.keys.push(key);
|
|
58
|
-
}
|
|
59
|
-
$scope.cache.put(key, angular.isUndefined(value) ? null : value);
|
|
60
|
-
};
|
|
61
|
-
}]);
|
|
62
|
-
</file>
|
|
63
|
-
<file name="style.css">
|
|
64
|
-
p {
|
|
65
|
-
margin: 10px 0 3px;
|
|
66
|
-
}
|
|
67
|
-
</file>
|
|
68
|
-
</example>
|
|
69
|
-
*/
|
|
70
3
|
export function CacheFactoryProvider() {
|
|
71
4
|
this.$get = function () {
|
|
72
5
|
const caches = {};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/\*\*
|
|
2
|
+
|
|
3
|
+
- @ngdoc service
|
|
4
|
+
- @name $cacheFactory
|
|
5
|
+
-
|
|
6
|
+
-
|
|
7
|
+
- @description
|
|
8
|
+
- Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
|
|
9
|
+
- them.
|
|
10
|
+
-
|
|
11
|
+
- ```js
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
-
|
|
16
|
+
- let cache = $cacheFactory('cacheId');
|
|
17
|
+
- expect($cacheFactory.get('cacheId')).toBe(cache);
|
|
18
|
+
- expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
|
|
19
|
+
-
|
|
20
|
+
- cache.put("key", "value");
|
|
21
|
+
- cache.put("another key", "another value");
|
|
22
|
+
-
|
|
23
|
+
- // We've specified no options on creation
|
|
24
|
+
- expect(cache.info()).toEqual({id: 'cacheId', size: 2});
|
|
25
|
+
-
|
|
26
|
+
- ```
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
-
|
|
31
|
+
-
|
|
32
|
+
- @example
|
|
33
|
+
<example module="cacheExampleApp" name="cache-factory">
|
|
34
|
+
<file name="index.html">
|
|
35
|
+
<div ng-controller="CacheController">
|
|
36
|
+
<input ng-model="newCacheKey" placeholder="Key">
|
|
37
|
+
<input ng-model="newCacheValue" placeholder="Value">
|
|
38
|
+
<button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
|
|
39
|
+
|
|
40
|
+
<p ng-if="keys.length">Cached Values</p>
|
|
41
|
+
<div ng-repeat="key in keys">
|
|
42
|
+
<span ng-bind="key"></span>
|
|
43
|
+
<span>: </span>
|
|
44
|
+
<b ng-bind="cache.get(key)"></b>
|
|
45
|
+
</div>
|
|
46
|
+
|
|
47
|
+
<p>Cache Info</p>
|
|
48
|
+
<div ng-repeat="(key, value) in cache.info()">
|
|
49
|
+
<span ng-bind="key"></span>
|
|
50
|
+
<span>: </span>
|
|
51
|
+
<b ng-bind="value"></b>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
54
|
+
</file>
|
|
55
|
+
<file name="script.js">
|
|
56
|
+
angular.module('cacheExampleApp', []).
|
|
57
|
+
controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
|
|
58
|
+
$scope.keys = [];
|
|
59
|
+
$scope.cache = $cacheFactory('cacheId');
|
|
60
|
+
$scope.put = function(key, value) {
|
|
61
|
+
if (angular.isUndefined($scope.cache.get(key))) {
|
|
62
|
+
$scope.keys.push(key);
|
|
63
|
+
}
|
|
64
|
+
$scope.cache.put(key, angular.isUndefined(value) ? null : value);
|
|
65
|
+
};
|
|
66
|
+
}]);
|
|
67
|
+
</file>
|
|
68
|
+
<file name="style.css">
|
|
69
|
+
p {
|
|
70
|
+
margin: 10px 0 3px;
|
|
71
|
+
}
|
|
72
|
+
</file>
|
|
73
|
+
|
|
74
|
+
</example>
|
|
75
|
+
*/
|