@angular-wave/angular.ts 0.4.2 → 0.4.4

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 (150) hide show
  1. package/dist/angular-ts.esm.js +2 -2
  2. package/dist/angular-ts.umd.js +12 -2
  3. package/index.html +74 -3
  4. package/package.json +7 -7
  5. package/src/angular.spec.js +1 -269
  6. package/src/animations/animate-css-driver.js +2 -2
  7. package/src/animations/animate-css.js +12 -21
  8. package/src/animations/animate-js-driver.js +1 -3
  9. package/src/animations/animate-js.js +4 -4
  10. package/src/animations/animate-queue.js +23 -23
  11. package/src/animations/animate-runner.js +4 -8
  12. package/src/animations/animate.md +1 -1
  13. package/src/animations/animate.spec.js +0 -21
  14. package/src/animations/animation.js +4 -4
  15. package/src/animations/shared.js +14 -12
  16. package/src/binding.spec.js +0 -1
  17. package/src/core/cache/cache.js +2 -29
  18. package/src/core/compile/attributes.js +2 -3
  19. package/src/core/compile/compile.js +260 -245
  20. package/src/core/compile/compile.spec.js +63 -317
  21. package/src/core/compile/compile.test.js +1 -1
  22. package/src/core/controller/controller.js +2 -0
  23. package/src/core/di/injector.md +1 -1
  24. package/src/core/di/injector.spec.js +0 -2
  25. package/src/core/di/internal-injector.js +2 -1
  26. package/src/core/interpolate/interpolate.js +16 -3
  27. package/src/core/interpolate/interpolate.spec.js +70 -16
  28. package/src/core/location/location.js +0 -2
  29. package/src/core/location/location.spec.js +27 -27
  30. package/src/core/{scope/scope.html → model/model.html} +1 -1
  31. package/src/core/model/model.js +944 -0
  32. package/src/core/model/model.spec.js +3012 -0
  33. package/src/core/on.spec.js +0 -7
  34. package/src/core/parse/interpreter.js +10 -7
  35. package/src/core/parse/parse.js +28 -7
  36. package/src/core/parse/parse.spec.js +95 -91
  37. package/src/core/prop.spec.js +4 -60
  38. package/src/core/sce/sce.js +1 -2
  39. package/src/core/sce/sce.spec.js +0 -8
  40. package/src/core/scope/scope.js +62 -32
  41. package/src/core/scope/scope.spec.js +25 -1960
  42. package/src/directive/aria/aria.js +3 -6
  43. package/src/directive/aria/aria.spec.js +0 -87
  44. package/src/directive/attrs/attrs.spec.js +0 -5
  45. package/src/directive/{list/list.test.js → attrs/attrs.test.js} +1 -1
  46. package/src/{core/q/q.html → directive/attrs/boolean.html} +1 -1
  47. package/src/directive/attrs/boolean.spec.js +0 -15
  48. package/src/{core/q/q.test.js → directive/attrs/boolean.test.js} +1 -2
  49. package/src/{core/timeout/timeout.html → directive/attrs/element-style.html} +4 -1
  50. package/src/directive/attrs/element-style.spec.js +0 -8
  51. package/src/{core/scope/scope.test.js → directive/attrs/element-style.test.js} +1 -2
  52. package/src/directive/attrs/src.spec.js +0 -7
  53. package/src/directive/bind/bind.spec.js +0 -33
  54. package/src/directive/bind/bing-html.spec.js +1 -4
  55. package/src/{core/interval/interval.html → directive/channel/channel.html} +1 -1
  56. package/src/directive/channel/channel.js +29 -0
  57. package/src/directive/channel/channel.spec.js +52 -0
  58. package/src/directive/channel/channel.test.js +9 -0
  59. package/src/directive/class/class.js +3 -3
  60. package/src/directive/class/class.spec.js +9 -75
  61. package/src/directive/controller/controller.spec.js +0 -13
  62. package/src/directive/events/click.spec.js +0 -3
  63. package/src/directive/events/event.spec.js +0 -6
  64. package/src/directive/form/form.js +14 -22
  65. package/src/directive/form/form.spec.js +0 -65
  66. package/src/directive/if/if.spec.js +2 -7
  67. package/src/directive/if/if.test.js +1 -2
  68. package/src/directive/include/include.js +2 -2
  69. package/src/directive/include/include.spec.js +8 -59
  70. package/src/directive/init/init.js +6 -2
  71. package/src/directive/init/init.spec.js +0 -2
  72. package/src/directive/input/input.js +1 -2
  73. package/src/directive/input/input.spec.js +191 -331
  74. package/src/directive/messages/messages.spec.js +4 -35
  75. package/src/directive/model/model.js +30 -42
  76. package/src/directive/model/model.spec.js +2 -49
  77. package/src/directive/model-options/model-options.js +22 -26
  78. package/src/directive/model-options/model-options.spec.js +0 -6
  79. package/src/directive/non-bindable/non-bindable.spec.js +0 -1
  80. package/src/directive/observe/observe.js +0 -1
  81. package/src/directive/observe/observe.spec.js +0 -1
  82. package/src/directive/options/options.js +1 -3
  83. package/src/directive/options/options.spec.js +3 -38
  84. package/src/directive/ref/href.spec.js +0 -15
  85. package/src/directive/repeat/repeat.js +2 -2
  86. package/src/directive/repeat/repeat.spec.js +56 -192
  87. package/src/directive/script/script.spec.js +0 -2
  88. package/src/directive/select/select.js +3 -3
  89. package/src/directive/select/select.spec.js +9 -106
  90. package/src/directive/show-hide/show-hide.js +2 -2
  91. package/src/directive/show-hide/show-hide.spec.js +8 -19
  92. package/src/directive/style/style.spec.js +0 -7
  93. package/src/directive/switch/switch.js +1 -2
  94. package/src/directive/switch/switch.spec.js +5 -5
  95. package/src/directive/validators/validators.spec.js +0 -1
  96. package/src/loader.js +0 -1
  97. package/src/public.js +75 -80
  98. package/src/router/common/coreservices.js +0 -2
  99. package/src/router/directives/state-directives.js +24 -30
  100. package/src/router/directives/state-directives.spec.js +0 -83
  101. package/src/router/directives/view-directive.js +6 -15
  102. package/src/router/directives/view-directive.spec.js +25 -71
  103. package/src/router/hooks/lazy-load.js +2 -2
  104. package/src/router/hooks/views.js +3 -5
  105. package/src/router/resolve/resolvable.js +3 -6
  106. package/src/router/resolve/resolve-context.js +2 -2
  107. package/src/router/state/state-service.js +4 -4
  108. package/src/router/state/state.spec.js +2 -5
  109. package/src/router/state/views.js +9 -12
  110. package/src/router/template-factory.js +3 -6
  111. package/src/router/template-factory.spec.js +0 -4
  112. package/src/router/transition/transition-hook.js +1 -1
  113. package/src/router/transition/transition.js +1 -1
  114. package/src/router/url/url-service.js +2 -8
  115. package/src/router/url/url-service.spec.js +3 -4
  116. package/src/router/view-hook.spec.js +2 -2
  117. package/src/router/view-scroll.js +4 -6
  118. package/src/services/http/http.js +11 -15
  119. package/src/services/http/http.spec.js +30 -31
  120. package/src/services/http/template-request.spec.js +0 -10
  121. package/src/services/http-backend/http-backend.js +19 -17
  122. package/src/services/http-backend/http-backend.spec.js +3 -3
  123. package/src/services/template-request.js +2 -4
  124. package/src/shared/common.js +6 -10
  125. package/src/shared/jqlite/jqlite.js +14 -15
  126. package/src/shared/jqlite/jqlite.spec.js +2 -2
  127. package/src/shared/utils.js +15 -92
  128. package/types/core/cache/cache.d.ts +1 -1
  129. package/types/core/model/model.d.ts +204 -0
  130. package/types/core/parse/parse.d.ts +26 -0
  131. package/types/core/scope/scope.d.ts +22 -21
  132. package/types/directive/channel/channel.d.ts +11 -0
  133. package/types/directive/form/form.d.ts +1 -0
  134. package/types/shared/common.d.ts +0 -1
  135. package/types/shared/utils.d.ts +0 -35
  136. package/src/core/interval/interval-factory.js +0 -50
  137. package/src/core/interval/interval.js +0 -77
  138. package/src/core/interval/interval.md +0 -123
  139. package/src/core/interval/interval.spec.js +0 -280
  140. package/src/core/q/q.js +0 -472
  141. package/src/core/q/q.md +0 -211
  142. package/src/core/q/q.spec.js +0 -2748
  143. package/src/core/timeout/timeout.js +0 -109
  144. package/src/core/timeout/timeout.spec.js +0 -354
  145. package/src/core/timeout/timout.test.js +0 -12
  146. package/src/directive/list/list.html +0 -18
  147. package/src/directive/list/list.js +0 -46
  148. package/src/directive/list/list.md +0 -22
  149. package/src/directive/list/list.spec.js +0 -172
  150. package/types/directive/list/list.d.ts +0 -4
@@ -1,7 +1,6 @@
1
1
  import { dealoc } from "../../shared/jqlite/jqlite";
2
2
  import { Angular } from "../../loader";
3
3
  import { map, find } from "../../shared/common";
4
- import { forEach } from "../../shared/utils";
5
4
 
6
5
  describe("UrlMatcher", () => {
7
6
  let $url;
@@ -244,7 +243,7 @@ describe("UrlMatcher", () => {
244
243
  "/url/someword/child/childParam",
245
244
  };
246
245
 
247
- forEach(shouldPass, function (url, route) {
246
+ Object.entries(shouldPass).forEach(function ([route, url]) {
248
247
  expect($url.compile(route).exec(url, {})).toEqual({
249
248
  childParam: "childParam",
250
249
  matchedParam: "someword",
@@ -260,7 +259,7 @@ describe("UrlMatcher", () => {
260
259
  "/url/someword/child/childParam",
261
260
  };
262
261
 
263
- forEach(shouldThrow, function (url, route) {
262
+ Object.entries(shouldThrow).forEach(function ([route, url]) {
264
263
  expect(() => {
265
264
  $url.compile(route).exec(url, {});
266
265
  }).toThrowError("Unbalanced capture group in route '" + route + "'");
@@ -273,7 +272,7 @@ describe("UrlMatcher", () => {
273
272
  "/url/someword/child/childParam",
274
273
  };
275
274
 
276
- forEach(shouldPass, function (url, route) {
275
+ Object.entries(shouldPass).forEach(function ([route, url]) {
277
276
  expect(() => {
278
277
  $url.compile(route).exec(url, {});
279
278
  }).not.toThrow();
@@ -129,7 +129,7 @@ describe("view hooks", () => {
129
129
  $state.defaultErrorHandler(function () {});
130
130
  ctrl.prototype.uiCanExit = function () {
131
131
  log += "canexit;";
132
- return $timeout(() => {
132
+ return setTimeout(() => {
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 $timeout(() => {
148
+ return setTimeout(() => {
149
149
  log += "delay;";
150
150
  }, 1);
151
151
  };
@@ -9,22 +9,20 @@ export class ViewScrollProvider {
9
9
 
10
10
  $get = [
11
11
  "$anchorScroll",
12
- "$timeout",
13
12
  /**
14
13
  * @param {import('../services/anchor-scroll').AnchorScrollObject} $anchorScroll
15
- * @param {*} $timeout
16
14
  * @returns {import('../services/anchor-scroll').AnchorScrollObject|Function}
17
15
  */
18
- ($anchorScroll, $timeout) => {
16
+ ($anchorScroll) => {
19
17
  if (this.enabled) {
20
18
  return $anchorScroll;
21
19
  }
22
20
  /**
23
21
  * @param {import('../shared/jqlite/jqlite').JQLite} $element
24
- * @returns {import('../core/q/q').QPromise<any>}
22
+ * @returns {Promise<number>}
25
23
  */
26
- return function ($element) {
27
- return $timeout(
24
+ return async function ($element) {
25
+ return setTimeout(
28
26
  () => {
29
27
  $element[0].scrollIntoView();
30
28
  },
@@ -7,7 +7,6 @@ import {
7
7
  toJson,
8
8
  isUndefined,
9
9
  isFunction,
10
- forEach,
11
10
  encodeUriQuery,
12
11
  isString,
13
12
  fromJson,
@@ -147,7 +146,7 @@ function parseHeaders(headers) {
147
146
  },
148
147
  );
149
148
  } else if (isObject(headers)) {
150
- forEach(headers, (headerVal, headerKey) => {
149
+ Object.entries(headers).forEach(([headerKey, headerVal]) => {
151
150
  fillInParsed(lowercase(headerKey), trim(headerVal));
152
151
  });
153
152
  }
@@ -382,7 +381,6 @@ export function HttpProvider() {
382
381
  "$browser",
383
382
  "$httpBackend",
384
383
  "$rootScope",
385
- "$q",
386
384
  "$injector",
387
385
  "$sce",
388
386
  /**
@@ -390,12 +388,11 @@ export function HttpProvider() {
390
388
  * @param {*} $browser
391
389
  * @param {*} $httpBackend
392
390
  * @param {*} $rootScope
393
- * @param {*} $q
394
391
  * @param {import("../../core/di/internal-injector").InjectorService} $injector
395
392
  * @param {*} $sce
396
393
  * @returns
397
394
  */
398
- function ($browser, $httpBackend, $rootScope, $q, $injector, $sce) {
395
+ function ($browser, $httpBackend, $rootScope, $injector, $sce) {
399
396
  /**
400
397
  * @type {Map<string, string>}
401
398
  */
@@ -469,10 +466,10 @@ export function HttpProvider() {
469
466
 
470
467
  const requestInterceptors = [];
471
468
  const responseInterceptors = [];
472
- let promise = $q.resolve(config);
469
+ let promise = Promise.resolve(config);
473
470
 
474
471
  // apply interceptors
475
- forEach(reversedInterceptors, (interceptor) => {
472
+ reversedInterceptors.forEach((interceptor) => {
476
473
  if (interceptor.request || interceptor.requestError) {
477
474
  requestInterceptors.unshift(
478
475
  interceptor.request,
@@ -515,7 +512,7 @@ export function HttpProvider() {
515
512
  let headerContent;
516
513
  const processedHeaders = {};
517
514
 
518
- forEach(headers, (headerFn, header) => {
515
+ Object.entries(headers).forEach(([header, headerFn]) => {
519
516
  if (isFunction(headerFn)) {
520
517
  headerContent = headerFn(config);
521
518
  if (headerContent != null) {
@@ -560,7 +557,7 @@ export function HttpProvider() {
560
557
 
561
558
  // strip content-type if data is undefined
562
559
  if (isUndefined(reqData)) {
563
- forEach(headers, (value, header) => {
560
+ Object.keys(headers).forEach((header) => {
564
561
  if (lowercase(header) === "content-type") {
565
562
  delete headers[header];
566
563
  }
@@ -590,7 +587,7 @@ export function HttpProvider() {
590
587
  response.status,
591
588
  config.transformResponse,
592
589
  );
593
- return isSuccess(response.status) ? resp : $q.reject(resp);
590
+ return isSuccess(response.status) ? resp : Promise.reject(resp);
594
591
  }
595
592
  }
596
593
 
@@ -733,8 +730,7 @@ export function HttpProvider() {
733
730
  * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests
734
731
  */
735
732
  function sendReq(config, reqData) {
736
- const deferred = $q.defer();
737
- const { promise } = deferred;
733
+ const { promise, resolve, reject } = Promise.withResolvers();
738
734
  let cache;
739
735
  let cachedResp;
740
736
  const reqHeaders = config.headers;
@@ -821,10 +817,10 @@ export function HttpProvider() {
821
817
  function createApplyHandlers(eventHandlers) {
822
818
  if (eventHandlers) {
823
819
  const applyHandlers = {};
824
- forEach(eventHandlers, (eventHandler, key) => {
820
+ Object.entries(eventHandlers).forEach(([key, eventHandler]) => {
825
821
  applyHandlers[key] = function (event) {
826
822
  if (useApplyAsync) {
827
- $rootScope.$applyAsync(callEventHandler);
823
+ setTimeout(() => $rootScope.$apply(callEventHandler));
828
824
  } else if ($rootScope.$$phase !== ScopePhase.NONE) {
829
825
  callEventHandler();
830
826
  } else {
@@ -893,7 +889,7 @@ export function HttpProvider() {
893
889
  // status: HTTP response status code, 0, -1 (aborted by timeout / promise)
894
890
  status = status >= -1 ? status : 0;
895
891
 
896
- (isSuccess(status) ? deferred.resolve : deferred.reject)({
892
+ (isSuccess(status) ? resolve : reject)({
897
893
  data: response,
898
894
  status,
899
895
  headers: headersGetter(headers),
@@ -19,7 +19,6 @@ 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");
23
22
  });
24
23
 
25
24
  it("is a function", function () {
@@ -2766,7 +2765,7 @@ describe("$http", function () {
2766
2765
  // doFirstCacheRequest();
2767
2766
 
2768
2767
  // await $http({ method: "get", url: "/url", cache }).then(callback);
2769
- // $rootScope.$digest();
2768
+ // ;
2770
2769
 
2771
2770
  // expect(callback).toHaveBeenCalled();
2772
2771
  // expect(callback.calls.mostRecent().args[0].data).toBe("content");
@@ -2786,7 +2785,7 @@ describe("$http", function () {
2786
2785
  // url: $sce.trustAsResourceUrl("/url"),
2787
2786
  // cache,
2788
2787
  // }).then(callback);
2789
- // $rootScope.$digest();
2788
+ // ;
2790
2789
 
2791
2790
  // expect(callback).toHaveBeenCalled();
2792
2791
  // expect(callback.calls.mostRecent().args[0].data).toBe("content");
@@ -2796,7 +2795,7 @@ describe("$http", function () {
2796
2795
  // doFirstCacheRequest();
2797
2796
 
2798
2797
  // await $http({ url: "/url", cache }).then(callback);
2799
- // $rootScope.$digest();
2798
+ // ;
2800
2799
 
2801
2800
  // expect(callback).toHaveBeenCalled();
2802
2801
  // expect(callback.calls.mostRecent().args[0].data).toBe("content");
@@ -2883,7 +2882,7 @@ describe("$http", function () {
2883
2882
  // });
2884
2883
 
2885
2884
  // await $http({ method: "GET", url: "/url", cache }).then(callback);
2886
- // $rootScope.$digest();
2885
+ // ;
2887
2886
  // expect(callback).toHaveBeenCalled();
2888
2887
  // }));
2889
2888
 
@@ -2900,7 +2899,7 @@ describe("$http", function () {
2900
2899
  // });
2901
2900
 
2902
2901
  // await $http({ method: "GET", url: "/url", cache }).then(callback);
2903
- // $rootScope.$digest();
2902
+ // ;
2904
2903
  // expect(callback).toHaveBeenCalled();
2905
2904
  // }));
2906
2905
 
@@ -2933,7 +2932,7 @@ describe("$http", function () {
2933
2932
  // });
2934
2933
 
2935
2934
  // await $http({ method: "get", url: "/url", cache }).then(callback);
2936
- // $rootScope.$digest();
2935
+ // ;
2937
2936
  // expect(callback).toHaveBeenCalled();
2938
2937
  // }));
2939
2938
 
@@ -2944,7 +2943,7 @@ describe("$http", function () {
2944
2943
  // });
2945
2944
 
2946
2945
  // await $http({ method: "get", url: "/url", cache }).then(callback);
2947
- // $rootScope.$digest();
2946
+ // ;
2948
2947
  // expect(callback).toHaveBeenCalled();
2949
2948
  // }));
2950
2949
 
@@ -2975,7 +2974,7 @@ describe("$http", function () {
2975
2974
  // cache,
2976
2975
  // headers: { foo: "baz" },
2977
2976
  // }).then(callback);
2978
- // $rootScope.$digest();
2977
+ // ;
2979
2978
 
2980
2979
  // expect(callback.calls.mostRecent().args[0].config.headers.foo).toBe(
2981
2980
  // "baz",
@@ -3030,7 +3029,7 @@ describe("$http", function () {
3030
3029
  // });
3031
3030
 
3032
3031
  // await $http({ method: "GET", url: "/abc", cache }).then(callback);
3033
- // $rootScope.$digest();
3032
+ // ;
3034
3033
  // expect(callback).toHaveBeenCalled();
3035
3034
  // });
3036
3035
 
@@ -3045,7 +3044,7 @@ describe("$http", function () {
3045
3044
  // callback();
3046
3045
  // });
3047
3046
 
3048
- // $rootScope.$digest();
3047
+ // ;
3049
3048
  // expect(callback).toHaveBeenCalled();
3050
3049
  // }));
3051
3050
 
@@ -3064,7 +3063,7 @@ describe("$http", function () {
3064
3063
 
3065
3064
  // // Second should be served from cache, without sending request to server.
3066
3065
  // await $http({ method: "get", url: "/url" }).then(callback);
3067
- // $rootScope.$digest();
3066
+ // ;
3068
3067
 
3069
3068
  // expect(callback).toHaveBeenCalled();
3070
3069
  // expect(callback.calls.mostRecent().args[0].data).toBe("content");
@@ -3100,7 +3099,7 @@ describe("$http", function () {
3100
3099
 
3101
3100
  // // Serve request from default cache when no local given.
3102
3101
  // await $http({ method: "get", url: "/url" }).then(callback);
3103
- // $rootScope.$digest();
3102
+ // ;
3104
3103
  // expect(callback).toHaveBeenCalled();
3105
3104
  // expect(callback.calls.mostRecent().args[0].data).toBe(
3106
3105
  // "content-default-cache",
@@ -3111,7 +3110,7 @@ describe("$http", function () {
3111
3110
  // await $http({ method: "get", url: "/url", cache: localCache }).then(
3112
3111
  // callback,
3113
3112
  // );
3114
- // $rootScope.$digest();
3113
+ // ;
3115
3114
  // expect(callback).toHaveBeenCalled();
3116
3115
  // expect(callback.calls.mostRecent().args[0].data).toBe(
3117
3116
  // "content-local-cache",
@@ -3197,7 +3196,7 @@ describe("$http", function () {
3197
3196
  // await $http({
3198
3197
  // method: "GET",
3199
3198
  // url: "/some",
3200
- // timeout: $timeout(() => {}, 10),
3199
+ // timeout: setTimeout(() => {}, 10),
3201
3200
  // }).then(onFulfilled, onRejected);
3202
3201
 
3203
3202
  // $timeout.flush(100);
@@ -3213,7 +3212,7 @@ describe("$http", function () {
3213
3212
  // expect($http.pendingRequests.length).toBe(0);
3214
3213
 
3215
3214
  // await $http({ method: "get", url: "/some" });
3216
- // $rootScope.$digest();
3215
+ // ;
3217
3216
  // expect($http.pendingRequests.length).toBe(1);
3218
3217
 
3219
3218
  // $httpBackend.flush();
@@ -3227,7 +3226,7 @@ describe("$http", function () {
3227
3226
 
3228
3227
  // await $http({ method: "get", url: "/cached", cache: true });
3229
3228
  // await $http({ method: "get", url: "/cached", cache: true });
3230
- // $rootScope.$digest();
3229
+ // ;
3231
3230
  // expect($http.pendingRequests.length).toBe(2);
3232
3231
 
3233
3232
  // $httpBackend.flush();
@@ -3235,7 +3234,7 @@ describe("$http", function () {
3235
3234
 
3236
3235
  // await $http({ method: "get", url: "/cached", cache: true });
3237
3236
  // spyOn($http.pendingRequests, "push").and.callThrough();
3238
- // $rootScope.$digest();
3237
+ // ;
3239
3238
  // expect($http.pendingRequests.push).toHaveBeenCalled();
3240
3239
 
3241
3240
  // $rootScope.$apply();
@@ -3248,7 +3247,7 @@ describe("$http", function () {
3248
3247
  // expect($http.pendingRequests.length).toBe(0);
3249
3248
  // });
3250
3249
 
3251
- // $rootScope.$digest();
3250
+ // ;
3252
3251
  // expect($http.pendingRequests.length).toBe(1);
3253
3252
  // $httpBackend.flush();
3254
3253
  // });
@@ -3343,7 +3342,7 @@ describe("$http", function () {
3343
3342
  // expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
3344
3343
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3345
3344
 
3346
- // $rootScope.$digest();
3345
+ // ;
3347
3346
 
3348
3347
  // expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
3349
3348
  // expect(completeOutstandingRequestSpy).toHaveBeenCalledOnceWith(
@@ -3423,7 +3422,7 @@ describe("$http", function () {
3423
3422
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3424
3423
 
3425
3424
  // $http.get("");
3426
- // $rootScope.$digest();
3425
+ // ;
3427
3426
 
3428
3427
  // expect(reqInterceptorFulfilled).toBe(false);
3429
3428
  // expect(resInterceptorFulfilled).toBe(false);
@@ -3439,7 +3438,7 @@ describe("$http", function () {
3439
3438
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3440
3439
 
3441
3440
  // resInterceptorDeferred.resolve();
3442
- // $rootScope.$digest();
3441
+ // ;
3443
3442
 
3444
3443
  // expect(reqInterceptorFulfilled).toBe(true);
3445
3444
  // expect(resInterceptorFulfilled).toBe(true);
@@ -3456,14 +3455,14 @@ describe("$http", function () {
3456
3455
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3457
3456
 
3458
3457
  // $http.get("").catch(() => {});
3459
- // $rootScope.$digest();
3458
+ // ;
3460
3459
 
3461
3460
  // expect(reqInterceptorFulfilled).toBe(false);
3462
3461
  // expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
3463
3462
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3464
3463
 
3465
3464
  // reqInterceptorDeferred.reject();
3466
- // $rootScope.$digest();
3465
+ // ;
3467
3466
 
3468
3467
  // expect(reqInterceptorFulfilled).toBe(true);
3469
3468
  // expect(incOutstandingRequestCountSpy).toHaveBeenCalledOnceWith("$http");
@@ -3480,7 +3479,7 @@ describe("$http", function () {
3480
3479
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3481
3480
 
3482
3481
  // $http.get("").catch(() => {});
3483
- // $rootScope.$digest();
3482
+ // ;
3484
3483
 
3485
3484
  // expect(reqInterceptorFulfilled).toBe(false);
3486
3485
  // expect(resInterceptorFulfilled).toBe(false);
@@ -3496,7 +3495,7 @@ describe("$http", function () {
3496
3495
  // expect(completeOutstandingRequestSpy).not.toHaveBeenCalled();
3497
3496
 
3498
3497
  // resInterceptorDeferred.reject();
3499
- // $rootScope.$digest();
3498
+ // ;
3500
3499
 
3501
3500
  // expect(reqInterceptorFulfilled).toBe(true);
3502
3501
  // expect(resInterceptorFulfilled).toBe(true);
@@ -3702,7 +3701,7 @@ describe("$http", function () {
3702
3701
  // withCredentials: true,
3703
3702
  // responseType: "json",
3704
3703
  // });
3705
- // $rootScope.$digest();
3704
+ // ;
3706
3705
  // expect($httpBackend).toHaveBeenCalled();
3707
3706
  // });
3708
3707
 
@@ -3730,7 +3729,7 @@ describe("$http", function () {
3730
3729
  // timeout: 12345,
3731
3730
  // responseType: "json",
3732
3731
  // });
3733
- // $rootScope.$digest();
3732
+ // ;
3734
3733
  // expect($httpBackend).toHaveBeenCalled();
3735
3734
  // });
3736
3735
 
@@ -3771,7 +3770,7 @@ describe("$http", function () {
3771
3770
  // .respond(200, "<h1>Header!</h1>", {});
3772
3771
  // $http.get("/template1.html").then(handler);
3773
3772
  // // Ensure requests are sent
3774
- // $rootScope.$digest();
3773
+ // ;
3775
3774
 
3776
3775
  // $httpBackend.flush(null, null, false);
3777
3776
  // expect($rootScope.$applyAsync).toHaveBeenCalled();
@@ -3792,7 +3791,7 @@ describe("$http", function () {
3792
3791
  // $http.get("/template1.html").then(log.fn("response 1"));
3793
3792
  // $http.get("/template2.html").then(log.fn("response 2"));
3794
3793
  // // Ensure requests are sent
3795
- // $rootScope.$digest();
3794
+ // ;
3796
3795
 
3797
3796
  // $httpBackend.flush(null, null, false);
3798
3797
  // expect(log).toEqual([]);
@@ -3816,7 +3815,7 @@ describe("$http", function () {
3816
3815
  // $http.get("/template2.html").then(log.fn("response 2"));
3817
3816
  // $http.get("/template3.html").then(log.fn("response 3"));
3818
3817
  // // Ensure requests are sent
3819
- // $rootScope.$digest();
3818
+ // ;
3820
3819
 
3821
3820
  // // Intermediate $digest occurs before 3rd response is received, assert that pending responses
3822
3821
  // /// are handled
@@ -102,7 +102,6 @@ describe("$templateRequest", () => {
102
102
  content = html;
103
103
  });
104
104
 
105
- $rootScope.$digest();
106
105
  expect(content).toBe("<div>Hello</div>");
107
106
  });
108
107
 
@@ -115,8 +114,6 @@ describe("$templateRequest", () => {
115
114
  await $templateRequest("/mock/div").then(tplRequestCb);
116
115
 
117
116
  $templateRequest("/mock/div").then(tplRequestCb);
118
- $rootScope.$digest();
119
-
120
117
  expect(content[0]).toBe("<div>Hello</div>");
121
118
  expect(content[1]).toBe("<div>Hello</div>");
122
119
  expect($templateCache.get("/mock/div")).toBe("<div>Hello</div>");
@@ -130,8 +127,6 @@ describe("$templateRequest", () => {
130
127
  }
131
128
 
132
129
  await $templateRequest("tpl.html").then(tplRequestCb);
133
- $rootScope.$digest();
134
-
135
130
  expect(content[0]).toBe("_matias");
136
131
  });
137
132
 
@@ -147,8 +142,6 @@ describe("$templateRequest", () => {
147
142
  it("should not call `$exceptionHandler` when the template is empty", async () => {
148
143
  const onError = jasmine.createSpy("onError");
149
144
  await $templateRequest("/mock/empty").catch(onError);
150
- $rootScope.$digest();
151
-
152
145
  expect(onError).not.toHaveBeenCalled();
153
146
  });
154
147
 
@@ -158,13 +151,11 @@ describe("$templateRequest", () => {
158
151
 
159
152
  expect(() => {
160
153
  $templateRequest("tpl.html"); // should go through $sce
161
- $rootScope.$digest();
162
154
  }).toThrow();
163
155
 
164
156
  $templateCache.set("tpl.html", ""); // should work (empty template)
165
157
  expect(() => {
166
158
  $templateRequest("tpl.html");
167
- $rootScope.$digest();
168
159
  }).not.toThrow();
169
160
  $templateCache = new Map();
170
161
  });
@@ -175,7 +166,6 @@ describe("$templateRequest", () => {
175
166
 
176
167
  expect($templateRequest.totalPendingRequests).toBe(2);
177
168
 
178
- $rootScope.$digest();
179
169
  await res;
180
170
  expect($templateRequest.totalPendingRequests).toBe(0);
181
171
  });
@@ -1,10 +1,5 @@
1
1
  import { urlResolve } from "../../core/url-utils/url-utils";
2
- import {
3
- forEach,
4
- isDefined,
5
- isPromiseLike,
6
- isUndefined,
7
- } from "../../shared/utils";
2
+ import { isDefined, isPromiseLike, isUndefined } from "../../shared/utils";
8
3
 
9
4
  /**
10
5
  * HTTP backend used by the {@link ng.$http service} that delegates to
@@ -51,11 +46,13 @@ export function createHttpBackend($browser) {
51
46
  let abortedByTimeout = false;
52
47
 
53
48
  xhr.open(method, url, true);
54
- forEach(headers, (value, key) => {
55
- if (isDefined(value)) {
56
- xhr.setRequestHeader(key, value);
57
- }
58
- });
49
+ if (headers) {
50
+ Object.entries(headers).forEach(([key, value]) => {
51
+ if (isDefined(value)) {
52
+ xhr.setRequestHeader(key, value);
53
+ }
54
+ });
55
+ }
59
56
 
60
57
  xhr.onload = function () {
61
58
  const statusText = xhr.statusText || "";
@@ -105,13 +102,18 @@ export function createHttpBackend($browser) {
105
102
  );
106
103
  };
107
104
 
108
- forEach(eventHandlers, (value, key) => {
109
- xhr.addEventListener(key, value);
110
- });
105
+ if (eventHandlers) {
106
+ eventHandlers &&
107
+ Object.entries(eventHandlers).forEach(([key, value]) => {
108
+ xhr.addEventListener(key, value);
109
+ });
110
+ }
111
111
 
112
- forEach(uploadEventHandlers, (value, key) => {
113
- xhr.upload.addEventListener(key, value);
114
- });
112
+ if (uploadEventHandlers) {
113
+ Object.entries(uploadEventHandlers).forEach(([key, value]) => {
114
+ xhr.upload.addEventListener(key, value);
115
+ });
116
+ }
115
117
 
116
118
  if (withCredentials) {
117
119
  xhr.withCredentials = true;
@@ -159,7 +159,7 @@ describe("$httpBackend", () => {
159
159
  // null,
160
160
  // callback,
161
161
  // {},
162
- // $timeout(() => {}, 2000),
162
+ // setTimeout(() => {}, 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
- // $timeout(() => {}, 2000),
182
+ // setTimeout(() => {}, 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
- // $timeout(() => {}, 2000),
247
+ // setTimeout(() => {}, 2000),
248
248
  // );
249
249
  // spyOn(xhr, "abort").and.callThrough();
250
250
 
@@ -57,18 +57,16 @@ export function TemplateRequestProvider() {
57
57
  "$exceptionHandler",
58
58
  "$templateCache",
59
59
  "$http",
60
- "$q",
61
60
  "$sce",
62
61
  /**
63
62
  *
64
63
  * @param {import('../core/exception-handler').ErrorHandler} $exceptionHandler
65
64
  * @param {import('../core/cache/cache-factory').TemplateCache} $templateCache
66
65
  * @param {*} $http
67
- * @param {*} $q
68
66
  * @param {*} $sce
69
67
  * @returns
70
68
  */
71
- function ($exceptionHandler, $templateCache, $http, $q, $sce) {
69
+ function ($exceptionHandler, $templateCache, $http, $sce) {
72
70
  function handleRequestFn(tpl, ignoreRequestError) {
73
71
  handleRequestFn.totalPendingRequests++;
74
72
 
@@ -124,7 +122,7 @@ export function TemplateRequestProvider() {
124
122
  $exceptionHandler(resp);
125
123
  }
126
124
 
127
- return $q.reject(resp);
125
+ return Promise.reject(resp);
128
126
  }
129
127
  }
130
128
 
@@ -1,11 +1,5 @@
1
1
  import { isDate, isFunction, isRegExp, isString } from "./utils";
2
2
  import { all, curry } from "./hof";
3
- import { services } from "../router/common/coreservices";
4
-
5
- export function forEach(obj, cb, thisArg) {
6
- if (Array.isArray(obj)) return obj.forEach(cb, thisArg);
7
- Object.keys(obj).forEach((key) => cb(obj[key], key));
8
- }
9
3
 
10
4
  export function equals(o1, o2) {
11
5
  if (o1 === o2) return true;
@@ -219,7 +213,7 @@ export function filter(collection, callback) {
219
213
  const arr = Array.isArray(collection),
220
214
  result = arr ? [] : {};
221
215
  const accept = arr ? (x) => result.push(x) : (x, key) => (result[key] = x);
222
- forEach(collection, function (item, i) {
216
+ Object.entries(collection).forEach(([i, item]) => {
223
217
  if (callback(item, i)) accept(item, i);
224
218
  });
225
219
  return result;
@@ -228,7 +222,7 @@ export function filter(collection, callback) {
228
222
  /** Finds an object from an array, or a property of an object, that matches a predicate */
229
223
  export function find(collection, callback) {
230
224
  let result;
231
- forEach(collection, function (item, i) {
225
+ Object.entries(collection).forEach(([i, item]) => {
232
226
  if (result) return;
233
227
  if (callback(item, i)) result = item;
234
228
  });
@@ -238,7 +232,9 @@ export function find(collection, callback) {
238
232
  /** Maps an array or object properties using a callback function */
239
233
  export function map(collection, callback, target) {
240
234
  target = target || (Array.isArray(collection) ? [] : {});
241
- forEach(collection, (item, i) => (target[i] = callback(item, i)));
235
+ Object.entries(collection).forEach(
236
+ ([i, item]) => (target[i] = callback(item, i)),
237
+ );
242
238
  return target;
243
239
  }
244
240
 
@@ -469,4 +465,4 @@ function _arraysEq(a1, a2) {
469
465
  export const silenceUncaughtInPromise = (promise) =>
470
466
  promise.catch(() => 0) && promise;
471
467
  export const silentRejection = (error) =>
472
- silenceUncaughtInPromise(services.$q.reject(error));
468
+ silenceUncaughtInPromise(Promise.reject(error));