@angular-wave/angular.ts 0.4.4 → 0.4.6
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/Makefile +1 -0
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -12
- package/index.html +3 -74
- package/package.json +1 -1
- package/src/angular.spec.js +5 -0
- package/src/animations/animate-css.js +13 -5
- package/src/animations/animate-queue.js +21 -22
- package/src/animations/animate-runner.js +8 -4
- package/src/animations/animate.md +1 -1
- package/src/animations/animate.spec.js +21 -0
- package/src/animations/animation.js +1 -1
- package/src/binding.spec.js +1 -0
- package/src/core/compile/compile.js +25 -27
- package/src/core/compile/compile.spec.js +266 -17
- package/src/core/controller/controller.js +0 -2
- package/src/core/di/injector.md +1 -1
- package/src/core/di/injector.spec.js +2 -0
- package/src/core/di/internal-injector.js +1 -2
- package/src/core/interpolate/interpolate.js +12 -28
- package/src/core/interpolate/interpolate.spec.js +16 -70
- package/src/core/interval/interval-factory.js +50 -0
- package/src/core/interval/interval.html +18 -0
- package/src/core/interval/interval.js +77 -0
- package/src/core/interval/interval.md +123 -0
- package/src/core/interval/interval.spec.js +280 -0
- package/src/core/interval/interval.test.js +1 -1
- package/src/core/location/location.js +53 -59
- package/src/core/location/location.spec.js +27 -27
- package/src/core/on.spec.js +7 -0
- package/src/core/parse/interpreter.js +7 -10
- package/src/core/parse/parse.js +5 -26
- package/src/core/parse/parse.spec.js +91 -95
- package/src/core/prop.spec.js +60 -4
- package/src/core/q/q.html +18 -0
- package/src/core/q/q.js +472 -0
- package/src/core/q/q.md +211 -0
- package/src/core/q/q.spec.js +2748 -0
- package/src/core/q/q.test.js +12 -0
- package/src/core/sce/sce.spec.js +8 -0
- package/src/core/{model/model.html → scope/scope.html} +1 -1
- package/src/core/scope/scope.js +16 -15
- package/src/core/scope/scope.spec.js +1959 -24
- package/src/core/scope/scope.test.js +12 -0
- package/src/core/timeout/timeout.html +18 -0
- package/src/core/timeout/timeout.js +109 -0
- package/src/core/timeout/timeout.spec.js +354 -0
- package/src/core/timeout/timout.test.js +12 -0
- package/src/core/url-utils/url-utils.spec.js +1 -1
- package/src/directive/aria/aria.js +6 -3
- package/src/directive/aria/aria.spec.js +87 -0
- package/src/directive/attrs/attrs.spec.js +5 -0
- package/src/directive/attrs/boolean.spec.js +15 -0
- package/src/directive/attrs/element-style.spec.js +8 -0
- package/src/directive/attrs/src.spec.js +7 -0
- package/src/directive/bind/bind.spec.js +33 -0
- package/src/directive/bind/bing-html.spec.js +3 -0
- package/src/directive/class/class.js +3 -3
- package/src/directive/class/class.spec.js +75 -9
- package/src/directive/controller/controller.spec.js +13 -0
- package/src/directive/events/click.spec.js +3 -0
- package/src/directive/events/event.spec.js +6 -0
- package/src/directive/events/events.html +1 -0
- package/src/directive/form/form.js +3 -2
- package/src/directive/form/form.spec.js +65 -0
- package/src/directive/if/if.spec.js +4 -0
- package/src/directive/include/include.spec.js +59 -8
- package/src/directive/init/init.js +2 -6
- package/src/directive/init/init.spec.js +2 -0
- package/src/directive/input/input.spec.js +136 -0
- package/src/directive/messages/messages.spec.js +35 -4
- package/src/directive/model/model.js +25 -18
- package/src/directive/model/model.spec.js +49 -2
- package/src/directive/model-options/model-options.spec.js +6 -0
- package/src/directive/non-bindable/non-bindable.spec.js +1 -0
- package/src/directive/observe/observe.js +5 -1
- package/src/directive/observe/observe.spec.js +22 -0
- package/src/directive/observe/test.html +3 -11
- package/src/directive/options/options.spec.js +34 -0
- package/src/directive/ref/href.spec.js +15 -0
- package/src/directive/repeat/repeat.spec.js +135 -8
- package/src/directive/script/script.spec.js +2 -0
- package/src/directive/select/select.js +3 -3
- package/src/directive/select/select.spec.js +96 -0
- package/src/directive/show-hide/show-hide.js +2 -2
- package/src/directive/show-hide/show-hide.spec.js +19 -8
- package/src/directive/style/style.spec.js +7 -0
- package/src/directive/switch/switch.spec.js +5 -5
- package/src/directive/validators/validators.spec.js +1 -0
- package/src/loader.js +1 -0
- package/src/public.js +10 -2
- package/src/router/common/coreservices.js +2 -0
- package/src/router/directives/state-directives.js +14 -6
- package/src/router/directives/state-directives.spec.js +83 -0
- package/src/router/directives/view-directive.js +13 -4
- package/src/router/directives/view-directive.spec.js +71 -25
- package/src/router/hooks/lazy-load.js +2 -2
- package/src/router/hooks/views.js +5 -3
- package/src/router/resolve/resolvable.js +6 -3
- package/src/router/resolve/resolve-context.js +2 -2
- package/src/router/state/state-service.js +4 -4
- package/src/router/state/state.spec.js +5 -2
- package/src/router/state/state.test.js +1 -1
- package/src/router/state/views.js +10 -7
- package/src/router/template-factory.js +6 -3
- package/src/router/template-factory.spec.js +4 -0
- package/src/router/transition/transition-hook.js +1 -1
- package/src/router/transition/transition.js +1 -1
- package/src/router/view-hook.spec.js +2 -2
- package/src/router/view-scroll.js +6 -4
- package/src/services/browser.js +5 -8
- package/src/services/http/http.js +9 -6
- package/src/services/http/http.spec.js +31 -30
- package/src/services/http/template-request.spec.js +10 -0
- package/src/services/http-backend/http-backend.spec.js +3 -3
- package/src/services/template-request.js +4 -2
- package/src/shared/common.js +2 -1
- package/types/core/location/location.d.ts +37 -34
- package/types/core/parse/parse.d.ts +0 -26
- package/types/core/scope/scope.d.ts +11 -11
- package/src/core/model/model.js +0 -944
- package/src/core/model/model.spec.js +0 -3012
- package/types/core/model/model.d.ts +0 -204
|
@@ -49,7 +49,7 @@ export class Transition {
|
|
|
49
49
|
constructor(fromPath, targetState, transitionService, globals) {
|
|
50
50
|
this.globals = globals;
|
|
51
51
|
this.transitionService = transitionService;
|
|
52
|
-
this._deferred =
|
|
52
|
+
this._deferred = services.$q.defer();
|
|
53
53
|
/**
|
|
54
54
|
* This promise is resolved or rejected based on the outcome of the Transition.
|
|
55
55
|
*
|
|
@@ -129,7 +129,7 @@ describe("view hooks", () => {
|
|
|
129
129
|
$state.defaultErrorHandler(function () {});
|
|
130
130
|
ctrl.prototype.uiCanExit = function () {
|
|
131
131
|
log += "canexit;";
|
|
132
|
-
return
|
|
132
|
+
return $timeout(() => {
|
|
133
133
|
log += "delay;";
|
|
134
134
|
return false;
|
|
135
135
|
}, 1);
|
|
@@ -145,7 +145,7 @@ describe("view hooks", () => {
|
|
|
145
145
|
it("can wait for a promise and then allow the transition", async () => {
|
|
146
146
|
ctrl.prototype.uiCanExit = function () {
|
|
147
147
|
log += "canexit;";
|
|
148
|
-
return
|
|
148
|
+
return $timeout(() => {
|
|
149
149
|
log += "delay;";
|
|
150
150
|
}, 1);
|
|
151
151
|
};
|
|
@@ -9,20 +9,22 @@ export class ViewScrollProvider {
|
|
|
9
9
|
|
|
10
10
|
$get = [
|
|
11
11
|
"$anchorScroll",
|
|
12
|
+
"$timeout",
|
|
12
13
|
/**
|
|
13
14
|
* @param {import('../services/anchor-scroll').AnchorScrollObject} $anchorScroll
|
|
15
|
+
* @param {*} $timeout
|
|
14
16
|
* @returns {import('../services/anchor-scroll').AnchorScrollObject|Function}
|
|
15
17
|
*/
|
|
16
|
-
($anchorScroll) => {
|
|
18
|
+
($anchorScroll, $timeout) => {
|
|
17
19
|
if (this.enabled) {
|
|
18
20
|
return $anchorScroll;
|
|
19
21
|
}
|
|
20
22
|
/**
|
|
21
23
|
* @param {import('../shared/jqlite/jqlite').JQLite} $element
|
|
22
|
-
* @returns {
|
|
24
|
+
* @returns {import('../core/q/q').QPromise<any>}
|
|
23
25
|
*/
|
|
24
|
-
return
|
|
25
|
-
return
|
|
26
|
+
return function ($element) {
|
|
27
|
+
return $timeout(
|
|
26
28
|
() => {
|
|
27
29
|
$element[0].scrollIntoView();
|
|
28
30
|
},
|
package/src/services/browser.js
CHANGED
|
@@ -110,15 +110,12 @@ export class Browser {
|
|
|
110
110
|
* @private
|
|
111
111
|
*/
|
|
112
112
|
cacheState() {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
this.
|
|
113
|
+
const currentState = history.state ?? null;
|
|
114
|
+
if (!equals(currentState, this.lastCachedState)) {
|
|
115
|
+
this.cachedState = currentState;
|
|
116
|
+
this.lastCachedState = currentState;
|
|
117
|
+
this.lastHistoryState = currentState;
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
this.lastCachedState = this.cachedState;
|
|
121
|
-
this.lastHistoryState = this.cachedState;
|
|
122
119
|
}
|
|
123
120
|
|
|
124
121
|
/**
|
|
@@ -381,6 +381,7 @@ export function HttpProvider() {
|
|
|
381
381
|
"$browser",
|
|
382
382
|
"$httpBackend",
|
|
383
383
|
"$rootScope",
|
|
384
|
+
"$q",
|
|
384
385
|
"$injector",
|
|
385
386
|
"$sce",
|
|
386
387
|
/**
|
|
@@ -388,11 +389,12 @@ export function HttpProvider() {
|
|
|
388
389
|
* @param {*} $browser
|
|
389
390
|
* @param {*} $httpBackend
|
|
390
391
|
* @param {*} $rootScope
|
|
392
|
+
* @param {*} $q
|
|
391
393
|
* @param {import("../../core/di/internal-injector").InjectorService} $injector
|
|
392
394
|
* @param {*} $sce
|
|
393
395
|
* @returns
|
|
394
396
|
*/
|
|
395
|
-
function ($browser, $httpBackend, $rootScope, $injector, $sce) {
|
|
397
|
+
function ($browser, $httpBackend, $rootScope, $q, $injector, $sce) {
|
|
396
398
|
/**
|
|
397
399
|
* @type {Map<string, string>}
|
|
398
400
|
*/
|
|
@@ -466,7 +468,7 @@ export function HttpProvider() {
|
|
|
466
468
|
|
|
467
469
|
const requestInterceptors = [];
|
|
468
470
|
const responseInterceptors = [];
|
|
469
|
-
let promise =
|
|
471
|
+
let promise = $q.resolve(config);
|
|
470
472
|
|
|
471
473
|
// apply interceptors
|
|
472
474
|
reversedInterceptors.forEach((interceptor) => {
|
|
@@ -587,7 +589,7 @@ export function HttpProvider() {
|
|
|
587
589
|
response.status,
|
|
588
590
|
config.transformResponse,
|
|
589
591
|
);
|
|
590
|
-
return isSuccess(response.status) ? resp :
|
|
592
|
+
return isSuccess(response.status) ? resp : $q.reject(resp);
|
|
591
593
|
}
|
|
592
594
|
}
|
|
593
595
|
|
|
@@ -730,7 +732,8 @@ export function HttpProvider() {
|
|
|
730
732
|
* $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests
|
|
731
733
|
*/
|
|
732
734
|
function sendReq(config, reqData) {
|
|
733
|
-
const
|
|
735
|
+
const deferred = $q.defer();
|
|
736
|
+
const { promise } = deferred;
|
|
734
737
|
let cache;
|
|
735
738
|
let cachedResp;
|
|
736
739
|
const reqHeaders = config.headers;
|
|
@@ -820,7 +823,7 @@ export function HttpProvider() {
|
|
|
820
823
|
Object.entries(eventHandlers).forEach(([key, eventHandler]) => {
|
|
821
824
|
applyHandlers[key] = function (event) {
|
|
822
825
|
if (useApplyAsync) {
|
|
823
|
-
|
|
826
|
+
$rootScope.$applyAsync(callEventHandler);
|
|
824
827
|
} else if ($rootScope.$$phase !== ScopePhase.NONE) {
|
|
825
828
|
callEventHandler();
|
|
826
829
|
} else {
|
|
@@ -889,7 +892,7 @@ export function HttpProvider() {
|
|
|
889
892
|
// status: HTTP response status code, 0, -1 (aborted by timeout / promise)
|
|
890
893
|
status = status >= -1 ? status : 0;
|
|
891
894
|
|
|
892
|
-
(isSuccess(status) ? resolve : reject)({
|
|
895
|
+
(isSuccess(status) ? deferred.resolve : deferred.reject)({
|
|
893
896
|
data: response,
|
|
894
897
|
status,
|
|
895
898
|
headers: headersGetter(headers),
|
|
@@ -19,6 +19,7 @@ describe("$http", function () {
|
|
|
19
19
|
$http = $injector.get("$http");
|
|
20
20
|
$httpBackend = $injector.get("$httpBackend");
|
|
21
21
|
$rootScope = $injector.get("$rootScope");
|
|
22
|
+
$q = $injector.get("$q");
|
|
22
23
|
});
|
|
23
24
|
|
|
24
25
|
it("is a function", function () {
|
|
@@ -2765,7 +2766,7 @@ describe("$http", function () {
|
|
|
2765
2766
|
// doFirstCacheRequest();
|
|
2766
2767
|
|
|
2767
2768
|
// await $http({ method: "get", url: "/url", cache }).then(callback);
|
|
2768
|
-
// ;
|
|
2769
|
+
// $rootScope.$digest();
|
|
2769
2770
|
|
|
2770
2771
|
// expect(callback).toHaveBeenCalled();
|
|
2771
2772
|
// expect(callback.calls.mostRecent().args[0].data).toBe("content");
|
|
@@ -2785,7 +2786,7 @@ describe("$http", function () {
|
|
|
2785
2786
|
// url: $sce.trustAsResourceUrl("/url"),
|
|
2786
2787
|
// cache,
|
|
2787
2788
|
// }).then(callback);
|
|
2788
|
-
// ;
|
|
2789
|
+
// $rootScope.$digest();
|
|
2789
2790
|
|
|
2790
2791
|
// expect(callback).toHaveBeenCalled();
|
|
2791
2792
|
// expect(callback.calls.mostRecent().args[0].data).toBe("content");
|
|
@@ -2795,7 +2796,7 @@ describe("$http", function () {
|
|
|
2795
2796
|
// doFirstCacheRequest();
|
|
2796
2797
|
|
|
2797
2798
|
// await $http({ url: "/url", cache }).then(callback);
|
|
2798
|
-
// ;
|
|
2799
|
+
// $rootScope.$digest();
|
|
2799
2800
|
|
|
2800
2801
|
// expect(callback).toHaveBeenCalled();
|
|
2801
2802
|
// expect(callback.calls.mostRecent().args[0].data).toBe("content");
|
|
@@ -2882,7 +2883,7 @@ describe("$http", function () {
|
|
|
2882
2883
|
// });
|
|
2883
2884
|
|
|
2884
2885
|
// await $http({ method: "GET", url: "/url", cache }).then(callback);
|
|
2885
|
-
// ;
|
|
2886
|
+
// $rootScope.$digest();
|
|
2886
2887
|
// expect(callback).toHaveBeenCalled();
|
|
2887
2888
|
// }));
|
|
2888
2889
|
|
|
@@ -2899,7 +2900,7 @@ describe("$http", function () {
|
|
|
2899
2900
|
// });
|
|
2900
2901
|
|
|
2901
2902
|
// await $http({ method: "GET", url: "/url", cache }).then(callback);
|
|
2902
|
-
// ;
|
|
2903
|
+
// $rootScope.$digest();
|
|
2903
2904
|
// expect(callback).toHaveBeenCalled();
|
|
2904
2905
|
// }));
|
|
2905
2906
|
|
|
@@ -2932,7 +2933,7 @@ describe("$http", function () {
|
|
|
2932
2933
|
// });
|
|
2933
2934
|
|
|
2934
2935
|
// await $http({ method: "get", url: "/url", cache }).then(callback);
|
|
2935
|
-
// ;
|
|
2936
|
+
// $rootScope.$digest();
|
|
2936
2937
|
// expect(callback).toHaveBeenCalled();
|
|
2937
2938
|
// }));
|
|
2938
2939
|
|
|
@@ -2943,7 +2944,7 @@ describe("$http", function () {
|
|
|
2943
2944
|
// });
|
|
2944
2945
|
|
|
2945
2946
|
// await $http({ method: "get", url: "/url", cache }).then(callback);
|
|
2946
|
-
// ;
|
|
2947
|
+
// $rootScope.$digest();
|
|
2947
2948
|
// expect(callback).toHaveBeenCalled();
|
|
2948
2949
|
// }));
|
|
2949
2950
|
|
|
@@ -2974,7 +2975,7 @@ describe("$http", function () {
|
|
|
2974
2975
|
// cache,
|
|
2975
2976
|
// headers: { foo: "baz" },
|
|
2976
2977
|
// }).then(callback);
|
|
2977
|
-
// ;
|
|
2978
|
+
// $rootScope.$digest();
|
|
2978
2979
|
|
|
2979
2980
|
// expect(callback.calls.mostRecent().args[0].config.headers.foo).toBe(
|
|
2980
2981
|
// "baz",
|
|
@@ -3029,7 +3030,7 @@ describe("$http", function () {
|
|
|
3029
3030
|
// });
|
|
3030
3031
|
|
|
3031
3032
|
// await $http({ method: "GET", url: "/abc", cache }).then(callback);
|
|
3032
|
-
// ;
|
|
3033
|
+
// $rootScope.$digest();
|
|
3033
3034
|
// expect(callback).toHaveBeenCalled();
|
|
3034
3035
|
// });
|
|
3035
3036
|
|
|
@@ -3044,7 +3045,7 @@ describe("$http", function () {
|
|
|
3044
3045
|
// callback();
|
|
3045
3046
|
// });
|
|
3046
3047
|
|
|
3047
|
-
// ;
|
|
3048
|
+
// $rootScope.$digest();
|
|
3048
3049
|
// expect(callback).toHaveBeenCalled();
|
|
3049
3050
|
// }));
|
|
3050
3051
|
|
|
@@ -3063,7 +3064,7 @@ describe("$http", function () {
|
|
|
3063
3064
|
|
|
3064
3065
|
// // Second should be served from cache, without sending request to server.
|
|
3065
3066
|
// await $http({ method: "get", url: "/url" }).then(callback);
|
|
3066
|
-
// ;
|
|
3067
|
+
// $rootScope.$digest();
|
|
3067
3068
|
|
|
3068
3069
|
// expect(callback).toHaveBeenCalled();
|
|
3069
3070
|
// expect(callback.calls.mostRecent().args[0].data).toBe("content");
|
|
@@ -3099,7 +3100,7 @@ describe("$http", function () {
|
|
|
3099
3100
|
|
|
3100
3101
|
// // Serve request from default cache when no local given.
|
|
3101
3102
|
// await $http({ method: "get", url: "/url" }).then(callback);
|
|
3102
|
-
// ;
|
|
3103
|
+
// $rootScope.$digest();
|
|
3103
3104
|
// expect(callback).toHaveBeenCalled();
|
|
3104
3105
|
// expect(callback.calls.mostRecent().args[0].data).toBe(
|
|
3105
3106
|
// "content-default-cache",
|
|
@@ -3110,7 +3111,7 @@ describe("$http", function () {
|
|
|
3110
3111
|
// await $http({ method: "get", url: "/url", cache: localCache }).then(
|
|
3111
3112
|
// callback,
|
|
3112
3113
|
// );
|
|
3113
|
-
// ;
|
|
3114
|
+
// $rootScope.$digest();
|
|
3114
3115
|
// expect(callback).toHaveBeenCalled();
|
|
3115
3116
|
// expect(callback.calls.mostRecent().args[0].data).toBe(
|
|
3116
3117
|
// "content-local-cache",
|
|
@@ -3196,7 +3197,7 @@ describe("$http", function () {
|
|
|
3196
3197
|
// await $http({
|
|
3197
3198
|
// method: "GET",
|
|
3198
3199
|
// url: "/some",
|
|
3199
|
-
// timeout:
|
|
3200
|
+
// timeout: $timeout(() => {}, 10),
|
|
3200
3201
|
// }).then(onFulfilled, onRejected);
|
|
3201
3202
|
|
|
3202
3203
|
// $timeout.flush(100);
|
|
@@ -3212,7 +3213,7 @@ describe("$http", function () {
|
|
|
3212
3213
|
// expect($http.pendingRequests.length).toBe(0);
|
|
3213
3214
|
|
|
3214
3215
|
// await $http({ method: "get", url: "/some" });
|
|
3215
|
-
// ;
|
|
3216
|
+
// $rootScope.$digest();
|
|
3216
3217
|
// expect($http.pendingRequests.length).toBe(1);
|
|
3217
3218
|
|
|
3218
3219
|
// $httpBackend.flush();
|
|
@@ -3226,7 +3227,7 @@ describe("$http", function () {
|
|
|
3226
3227
|
|
|
3227
3228
|
// await $http({ method: "get", url: "/cached", cache: true });
|
|
3228
3229
|
// await $http({ method: "get", url: "/cached", cache: true });
|
|
3229
|
-
// ;
|
|
3230
|
+
// $rootScope.$digest();
|
|
3230
3231
|
// expect($http.pendingRequests.length).toBe(2);
|
|
3231
3232
|
|
|
3232
3233
|
// $httpBackend.flush();
|
|
@@ -3234,7 +3235,7 @@ describe("$http", function () {
|
|
|
3234
3235
|
|
|
3235
3236
|
// await $http({ method: "get", url: "/cached", cache: true });
|
|
3236
3237
|
// spyOn($http.pendingRequests, "push").and.callThrough();
|
|
3237
|
-
// ;
|
|
3238
|
+
// $rootScope.$digest();
|
|
3238
3239
|
// expect($http.pendingRequests.push).toHaveBeenCalled();
|
|
3239
3240
|
|
|
3240
3241
|
// $rootScope.$apply();
|
|
@@ -3247,7 +3248,7 @@ describe("$http", function () {
|
|
|
3247
3248
|
// expect($http.pendingRequests.length).toBe(0);
|
|
3248
3249
|
// });
|
|
3249
3250
|
|
|
3250
|
-
// ;
|
|
3251
|
+
// $rootScope.$digest();
|
|
3251
3252
|
// expect($http.pendingRequests.length).toBe(1);
|
|
3252
3253
|
// $httpBackend.flush();
|
|
3253
3254
|
// });
|
|
@@ -3342,7 +3343,7 @@ describe("$http", function () {
|
|
|
3342
3343
|
// expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
|
|
3343
3344
|
// expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
|
|
3344
3345
|
|
|
3345
|
-
// ;
|
|
3346
|
+
// $rootScope.$digest();
|
|
3346
3347
|
|
|
3347
3348
|
// expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
|
|
3348
3349
|
// expect(completeOutstandingRequestSpy).toHaveBeenCalledOnceWith(
|
|
@@ -3422,7 +3423,7 @@ describe("$http", function () {
|
|
|
3422
3423
|
// expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
|
|
3423
3424
|
|
|
3424
3425
|
// $http.get("");
|
|
3425
|
-
// ;
|
|
3426
|
+
// $rootScope.$digest();
|
|
3426
3427
|
|
|
3427
3428
|
// expect(reqInterceptorFulfilled).toBe(false);
|
|
3428
3429
|
// expect(resInterceptorFulfilled).toBe(false);
|
|
@@ -3438,7 +3439,7 @@ describe("$http", function () {
|
|
|
3438
3439
|
// expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
|
|
3439
3440
|
|
|
3440
3441
|
// resInterceptorDeferred.resolve();
|
|
3441
|
-
// ;
|
|
3442
|
+
// $rootScope.$digest();
|
|
3442
3443
|
|
|
3443
3444
|
// expect(reqInterceptorFulfilled).toBe(true);
|
|
3444
3445
|
// expect(resInterceptorFulfilled).toBe(true);
|
|
@@ -3455,14 +3456,14 @@ describe("$http", function () {
|
|
|
3455
3456
|
// expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
|
|
3456
3457
|
|
|
3457
3458
|
// $http.get("").catch(() => {});
|
|
3458
|
-
// ;
|
|
3459
|
+
// $rootScope.$digest();
|
|
3459
3460
|
|
|
3460
3461
|
// expect(reqInterceptorFulfilled).toBe(false);
|
|
3461
3462
|
// expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
|
|
3462
3463
|
// expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
|
|
3463
3464
|
|
|
3464
3465
|
// reqInterceptorDeferred.reject();
|
|
3465
|
-
// ;
|
|
3466
|
+
// $rootScope.$digest();
|
|
3466
3467
|
|
|
3467
3468
|
// expect(reqInterceptorFulfilled).toBe(true);
|
|
3468
3469
|
// expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
|
|
@@ -3479,7 +3480,7 @@ describe("$http", function () {
|
|
|
3479
3480
|
// expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
|
|
3480
3481
|
|
|
3481
3482
|
// $http.get("").catch(() => {});
|
|
3482
|
-
// ;
|
|
3483
|
+
// $rootScope.$digest();
|
|
3483
3484
|
|
|
3484
3485
|
// expect(reqInterceptorFulfilled).toBe(false);
|
|
3485
3486
|
// expect(resInterceptorFulfilled).toBe(false);
|
|
@@ -3495,7 +3496,7 @@ describe("$http", function () {
|
|
|
3495
3496
|
// expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
|
|
3496
3497
|
|
|
3497
3498
|
// resInterceptorDeferred.reject();
|
|
3498
|
-
// ;
|
|
3499
|
+
// $rootScope.$digest();
|
|
3499
3500
|
|
|
3500
3501
|
// expect(reqInterceptorFulfilled).toBe(true);
|
|
3501
3502
|
// expect(resInterceptorFulfilled).toBe(true);
|
|
@@ -3701,7 +3702,7 @@ describe("$http", function () {
|
|
|
3701
3702
|
// withCredentials: true,
|
|
3702
3703
|
// responseType: "json",
|
|
3703
3704
|
// });
|
|
3704
|
-
// ;
|
|
3705
|
+
// $rootScope.$digest();
|
|
3705
3706
|
// expect($httpBackend).toHaveBeenCalled();
|
|
3706
3707
|
// });
|
|
3707
3708
|
|
|
@@ -3729,7 +3730,7 @@ describe("$http", function () {
|
|
|
3729
3730
|
// timeout: 12345,
|
|
3730
3731
|
// responseType: "json",
|
|
3731
3732
|
// });
|
|
3732
|
-
// ;
|
|
3733
|
+
// $rootScope.$digest();
|
|
3733
3734
|
// expect($httpBackend).toHaveBeenCalled();
|
|
3734
3735
|
// });
|
|
3735
3736
|
|
|
@@ -3770,7 +3771,7 @@ describe("$http", function () {
|
|
|
3770
3771
|
// .respond(200, "<h1>Header!</h1>", {});
|
|
3771
3772
|
// $http.get("/template1.html").then(handler);
|
|
3772
3773
|
// // Ensure requests are sent
|
|
3773
|
-
// ;
|
|
3774
|
+
// $rootScope.$digest();
|
|
3774
3775
|
|
|
3775
3776
|
// $httpBackend.flush(null, null, false);
|
|
3776
3777
|
// expect($rootScope.$applyAsync).toHaveBeenCalled();
|
|
@@ -3791,7 +3792,7 @@ describe("$http", function () {
|
|
|
3791
3792
|
// $http.get("/template1.html").then(log.fn("response 1"));
|
|
3792
3793
|
// $http.get("/template2.html").then(log.fn("response 2"));
|
|
3793
3794
|
// // Ensure requests are sent
|
|
3794
|
-
// ;
|
|
3795
|
+
// $rootScope.$digest();
|
|
3795
3796
|
|
|
3796
3797
|
// $httpBackend.flush(null, null, false);
|
|
3797
3798
|
// expect(log).toEqual([]);
|
|
@@ -3815,7 +3816,7 @@ describe("$http", function () {
|
|
|
3815
3816
|
// $http.get("/template2.html").then(log.fn("response 2"));
|
|
3816
3817
|
// $http.get("/template3.html").then(log.fn("response 3"));
|
|
3817
3818
|
// // Ensure requests are sent
|
|
3818
|
-
// ;
|
|
3819
|
+
// $rootScope.$digest();
|
|
3819
3820
|
|
|
3820
3821
|
// // Intermediate $digest occurs before 3rd response is received, assert that pending responses
|
|
3821
3822
|
// /// are handled
|
|
@@ -102,6 +102,7 @@ describe("$templateRequest", () => {
|
|
|
102
102
|
content = html;
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
+
$rootScope.$digest();
|
|
105
106
|
expect(content).toBe("<div>Hello</div>");
|
|
106
107
|
});
|
|
107
108
|
|
|
@@ -114,6 +115,8 @@ describe("$templateRequest", () => {
|
|
|
114
115
|
await $templateRequest("/mock/div").then(tplRequestCb);
|
|
115
116
|
|
|
116
117
|
$templateRequest("/mock/div").then(tplRequestCb);
|
|
118
|
+
$rootScope.$digest();
|
|
119
|
+
|
|
117
120
|
expect(content[0]).toBe("<div>Hello</div>");
|
|
118
121
|
expect(content[1]).toBe("<div>Hello</div>");
|
|
119
122
|
expect($templateCache.get("/mock/div")).toBe("<div>Hello</div>");
|
|
@@ -127,6 +130,8 @@ describe("$templateRequest", () => {
|
|
|
127
130
|
}
|
|
128
131
|
|
|
129
132
|
await $templateRequest("tpl.html").then(tplRequestCb);
|
|
133
|
+
$rootScope.$digest();
|
|
134
|
+
|
|
130
135
|
expect(content[0]).toBe("_matias");
|
|
131
136
|
});
|
|
132
137
|
|
|
@@ -142,6 +147,8 @@ describe("$templateRequest", () => {
|
|
|
142
147
|
it("should not call `$exceptionHandler` when the template is empty", async () => {
|
|
143
148
|
const onError = jasmine.createSpy("onError");
|
|
144
149
|
await $templateRequest("/mock/empty").catch(onError);
|
|
150
|
+
$rootScope.$digest();
|
|
151
|
+
|
|
145
152
|
expect(onError).not.toHaveBeenCalled();
|
|
146
153
|
});
|
|
147
154
|
|
|
@@ -151,11 +158,13 @@ describe("$templateRequest", () => {
|
|
|
151
158
|
|
|
152
159
|
expect(() => {
|
|
153
160
|
$templateRequest("tpl.html"); // should go through $sce
|
|
161
|
+
$rootScope.$digest();
|
|
154
162
|
}).toThrow();
|
|
155
163
|
|
|
156
164
|
$templateCache.set("tpl.html", ""); // should work (empty template)
|
|
157
165
|
expect(() => {
|
|
158
166
|
$templateRequest("tpl.html");
|
|
167
|
+
$rootScope.$digest();
|
|
159
168
|
}).not.toThrow();
|
|
160
169
|
$templateCache = new Map();
|
|
161
170
|
});
|
|
@@ -166,6 +175,7 @@ describe("$templateRequest", () => {
|
|
|
166
175
|
|
|
167
176
|
expect($templateRequest.totalPendingRequests).toBe(2);
|
|
168
177
|
|
|
178
|
+
$rootScope.$digest();
|
|
169
179
|
await res;
|
|
170
180
|
expect($templateRequest.totalPendingRequests).toBe(0);
|
|
171
181
|
});
|
|
@@ -159,7 +159,7 @@ describe("$httpBackend", () => {
|
|
|
159
159
|
// null,
|
|
160
160
|
// callback,
|
|
161
161
|
// {},
|
|
162
|
-
//
|
|
162
|
+
// $timeout(() => {}, 2000),
|
|
163
163
|
// );
|
|
164
164
|
// spyOn(xhr, "abort");
|
|
165
165
|
// expect(xhr.abort).toHaveBeenCalled();
|
|
@@ -179,7 +179,7 @@ describe("$httpBackend", () => {
|
|
|
179
179
|
// null,
|
|
180
180
|
// callback,
|
|
181
181
|
// {},
|
|
182
|
-
//
|
|
182
|
+
// $timeout(() => {}, 2000),
|
|
183
183
|
// );
|
|
184
184
|
// xhr = MockXhr.$$lastInstance;
|
|
185
185
|
// spyOn(xhr, "abort");
|
|
@@ -244,7 +244,7 @@ describe("$httpBackend", () => {
|
|
|
244
244
|
// null,
|
|
245
245
|
// callback,
|
|
246
246
|
// {},
|
|
247
|
-
//
|
|
247
|
+
// $timeout(() => {}, 2000),
|
|
248
248
|
// );
|
|
249
249
|
// spyOn(xhr, "abort").and.callThrough();
|
|
250
250
|
|
|
@@ -57,16 +57,18 @@ export function TemplateRequestProvider() {
|
|
|
57
57
|
"$exceptionHandler",
|
|
58
58
|
"$templateCache",
|
|
59
59
|
"$http",
|
|
60
|
+
"$q",
|
|
60
61
|
"$sce",
|
|
61
62
|
/**
|
|
62
63
|
*
|
|
63
64
|
* @param {import('../core/exception-handler').ErrorHandler} $exceptionHandler
|
|
64
65
|
* @param {import('../core/cache/cache-factory').TemplateCache} $templateCache
|
|
65
66
|
* @param {*} $http
|
|
67
|
+
* @param {*} $q
|
|
66
68
|
* @param {*} $sce
|
|
67
69
|
* @returns
|
|
68
70
|
*/
|
|
69
|
-
function ($exceptionHandler, $templateCache, $http, $sce) {
|
|
71
|
+
function ($exceptionHandler, $templateCache, $http, $q, $sce) {
|
|
70
72
|
function handleRequestFn(tpl, ignoreRequestError) {
|
|
71
73
|
handleRequestFn.totalPendingRequests++;
|
|
72
74
|
|
|
@@ -122,7 +124,7 @@ export function TemplateRequestProvider() {
|
|
|
122
124
|
$exceptionHandler(resp);
|
|
123
125
|
}
|
|
124
126
|
|
|
125
|
-
return
|
|
127
|
+
return $q.reject(resp);
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
|
package/src/shared/common.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isDate, isFunction, isRegExp, isString } from "./utils";
|
|
2
2
|
import { all, curry } from "./hof";
|
|
3
|
+
import { services } from "../router/common/coreservices";
|
|
3
4
|
|
|
4
5
|
export function equals(o1, o2) {
|
|
5
6
|
if (o1 === o2) return true;
|
|
@@ -465,4 +466,4 @@ function _arraysEq(a1, a2) {
|
|
|
465
466
|
export const silenceUncaughtInPromise = (promise) =>
|
|
466
467
|
promise.catch(() => 0) && promise;
|
|
467
468
|
export const silentRejection = (error) =>
|
|
468
|
-
silenceUncaughtInPromise(
|
|
469
|
+
silenceUncaughtInPromise(services.$q.reject(error));
|
|
@@ -1,34 +1,3 @@
|
|
|
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
|
-
}
|
|
32
1
|
/**
|
|
33
2
|
*
|
|
34
3
|
* @param {string} base
|
|
@@ -261,21 +230,55 @@ export class LocationHtml5Url extends Location {
|
|
|
261
230
|
*/
|
|
262
231
|
export class LocationHashbangUrl extends Location {
|
|
263
232
|
constructor(appBase: any, appBaseNoFile: any, hashPrefix: any);
|
|
264
|
-
appBase: any;
|
|
265
|
-
appBaseNoFile: any;
|
|
266
233
|
hashPrefix: any;
|
|
267
234
|
/**
|
|
268
235
|
* Parse given hashbang URL into properties
|
|
269
236
|
* @param {string} url Hashbang URL
|
|
270
237
|
*/
|
|
271
238
|
$$parse(url: string): void;
|
|
272
|
-
$$normalizeUrl(url: any):
|
|
239
|
+
$$normalizeUrl(url: any): string;
|
|
273
240
|
/**
|
|
274
241
|
* @param {string} url
|
|
275
242
|
* @returns {boolean}
|
|
276
243
|
*/
|
|
277
244
|
$$parseLinkUrl(url: string): boolean;
|
|
278
245
|
}
|
|
246
|
+
export class LocationProvider {
|
|
247
|
+
hashPrefixValue: string;
|
|
248
|
+
html5ModeConfig: {
|
|
249
|
+
enabled: boolean;
|
|
250
|
+
requireBase: boolean;
|
|
251
|
+
rewriteLinks: boolean;
|
|
252
|
+
};
|
|
253
|
+
/**
|
|
254
|
+
* The default value for the prefix is `'!'`.
|
|
255
|
+
* @param {string=} prefix - Prefix for hash part (containing path and search)
|
|
256
|
+
* @returns {string|LocationProvider} current value if used as getter or itself (chaining) if used as setter
|
|
257
|
+
*/
|
|
258
|
+
hashPrefix(prefix?: string | undefined): string | LocationProvider;
|
|
259
|
+
/**
|
|
260
|
+
* @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.
|
|
261
|
+
* If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported
|
|
262
|
+
* properties:
|
|
263
|
+
* - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to
|
|
264
|
+
* change urls where supported. Will fall back to hash-prefixed paths in browsers that do not
|
|
265
|
+
* support `pushState`.
|
|
266
|
+
* - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies
|
|
267
|
+
* whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are
|
|
268
|
+
* true, and a base tag is not present, an error will be thrown when `$location` is injected.
|
|
269
|
+
* See the {@link guide/$location $location guide for more information}
|
|
270
|
+
* - **rewriteLinks** - `{boolean|string}` - (default: `true`) When html5Mode is enabled,
|
|
271
|
+
* enables/disables URL rewriting for relative links. If set to a string, URL rewriting will
|
|
272
|
+
* only happen on links with an attribute that matches the given string. For example, if set
|
|
273
|
+
* to `'internal-link'`, then the URL will only be rewritten for `<a internal-link>` links.
|
|
274
|
+
* Note that [attribute name normalization](guide/directive#normalization) does not apply
|
|
275
|
+
* here, so `'internalLink'` will **not** match `'internal-link'`.
|
|
276
|
+
*
|
|
277
|
+
* @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter
|
|
278
|
+
*/
|
|
279
|
+
html5Mode(mode?: (boolean | any) | undefined): any;
|
|
280
|
+
$get: (string | (($rootScope: import("../scope/scope").Scope, $browser: import("../../services/browser").Browser, $rootElement: JQLite) => Location))[];
|
|
281
|
+
}
|
|
279
282
|
export type DefaultPorts = {
|
|
280
283
|
http: number;
|
|
281
284
|
https: number;
|