@angular-wave/angular.ts 0.7.7 → 0.8.0

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 (376) hide show
  1. package/@types/animations/raf-scheduler.d.ts +2 -2
  2. package/@types/animations/shared.d.ts +0 -1
  3. package/@types/core/compile/attributes.d.ts +3 -3
  4. package/@types/core/compile/compile.d.ts +1 -1
  5. package/@types/core/di/injector.d.ts +0 -1
  6. package/@types/core/di/internal-injector.d.ts +1 -0
  7. package/@types/core/di/ng-module.d.ts +5 -0
  8. package/@types/core/filter/filter.d.ts +11 -13
  9. package/@types/core/parse/parse.d.ts +6 -7
  10. package/@types/core/sanitize/sanitize-uri.d.ts +3 -6
  11. package/@types/core/scope/scope.d.ts +1 -1
  12. package/@types/directive/attrs/attrs.d.ts +7 -1
  13. package/@types/directive/bind/bind.d.ts +2 -1
  14. package/@types/directive/events/events.d.ts +9 -3
  15. package/@types/directive/http/http.d.ts +6 -2
  16. package/@types/directive/include/include.d.ts +2 -2
  17. package/@types/directive/input/input.d.ts +2 -12
  18. package/@types/directive/messages/messages.d.ts +9 -48
  19. package/@types/directive/model/model.d.ts +3 -3
  20. package/@types/directive/options/options.d.ts +13 -20
  21. package/@types/directive/switch/switch.d.ts +1 -0
  22. package/@types/directive/transclude/transclude.d.ts +10 -6
  23. package/@types/index.d.ts +1 -1
  24. package/@types/interface.d.ts +56 -18
  25. package/@types/{public.d.ts → ng.d.ts} +2 -2
  26. package/@types/router/directives/view-directive.d.ts +2 -19
  27. package/@types/router/{common → glob}/glob.d.ts +5 -1
  28. package/@types/router/globals.d.ts +2 -3
  29. package/@types/router/path/path-utils.d.ts +8 -11
  30. package/@types/router/state/interface.d.ts +1 -1
  31. package/@types/router/state/state-object.d.ts +1 -1
  32. package/@types/router/state/state-registry.d.ts +1 -2
  33. package/@types/router/state/state-service.d.ts +8 -7
  34. package/@types/router/state-filters.d.ts +24 -2
  35. package/@types/router/transition/transition.d.ts +12 -15
  36. package/@types/router/url/url-matcher.d.ts +3 -3
  37. package/@types/router/url/url-rule.d.ts +1 -0
  38. package/@types/router/url/url-rules.d.ts +26 -6
  39. package/@types/router/url/url-service.d.ts +30 -42
  40. package/@types/services/anchor-scroll.d.ts +1 -1
  41. package/@types/{core → services/exception}/exception-handler.d.ts +4 -4
  42. package/@types/{core/error-handler.d.ts → services/exception/interface.d.ts} +1 -1
  43. package/@types/services/http/http.d.ts +48 -3
  44. package/@types/services/http/interface.d.ts +2 -2
  45. package/@types/services/http-backend/http-backend.d.ts +49 -44
  46. package/@types/services/location/interface.d.ts +63 -0
  47. package/@types/services/location/location.d.ts +330 -0
  48. package/@types/{core → services}/sce/sce.d.ts +1 -1
  49. package/@types/services/template-cache/interface.d.ts +8 -2
  50. package/@types/services/template-cache/template-cache.d.ts +1 -1
  51. package/@types/services/template-request.d.ts +1 -1
  52. package/@types/shared/cache.d.ts +0 -2
  53. package/@types/shared/common.d.ts +0 -2
  54. package/@types/shared/dom.d.ts +6 -0
  55. package/@types/shared/interface.d.ts +0 -4
  56. package/@types/{router/common → shared}/queue.d.ts +2 -2
  57. package/@types/shared/test-utils.d.ts +1 -0
  58. package/@types/shared/url-utils/interface.d.ts +46 -0
  59. package/@types/shared/url-utils/url-utils.d.ts +64 -0
  60. package/@types/shared/utils.d.ts +44 -6
  61. package/Makefile +8 -4
  62. package/dist/angular-ts.esm.js +1889 -2199
  63. package/dist/angular-ts.umd.js +1889 -2199
  64. package/dist/angular-ts.umd.min.js +1 -1
  65. package/docs/assets/scss/index.scss +23 -0
  66. package/docs/content/_index.md +9 -8
  67. package/docs/content/docs/_index.md +1 -1
  68. package/docs/content/docs/directive/app.md +1 -1
  69. package/docs/content/docs/directive/bind.md +10 -8
  70. package/docs/content/docs/directive/blur.md +1 -1
  71. package/docs/content/docs/directive/channel.md +2 -2
  72. package/docs/content/docs/directive/class-even.md +1 -1
  73. package/docs/content/docs/directive/class-odd.md +1 -1
  74. package/docs/content/docs/directive/class.md +1 -1
  75. package/docs/content/docs/directive/click.md +1 -1
  76. package/docs/content/docs/directive/copy.md +1 -1
  77. package/docs/content/docs/directive/cut.md +1 -1
  78. package/docs/content/docs/directive/dblclick.md +1 -1
  79. package/docs/content/docs/directive/focus.md +1 -1
  80. package/docs/content/docs/directive/get.md +203 -0
  81. package/docs/content/docs/directive/keydown.md +1 -1
  82. package/docs/content/docs/directive/keyup.md +1 -1
  83. package/docs/content/docs/directive/load.md +1 -1
  84. package/docs/content/docs/directive/mousedown.md +1 -1
  85. package/docs/content/docs/directive/mouseenter.md +1 -1
  86. package/docs/content/docs/directive/mouseleave.md +1 -1
  87. package/docs/content/docs/directive/mousemove.md +1 -1
  88. package/docs/content/docs/directive/mouseout.md +1 -1
  89. package/docs/content/docs/directive/mouseover.md +1 -1
  90. package/docs/content/docs/directive/mouseup.md +1 -1
  91. package/docs/content/docs/directive/non-bindable.md +28 -0
  92. package/docs/content/docs/provider/locationProvider.md +26 -0
  93. package/docs/content/docs/provider/templateCacheProvider.md +66 -1
  94. package/docs/content/docs/service/location.md +57 -0
  95. package/docs/content/docs/service/templateCache.md +2 -2
  96. package/docs/content/docs/service/url.md +5 -0
  97. package/docs/layouts/partials/hooks/head-end.html +1 -1
  98. package/docs/layouts/shortcodes/showcss.html +2 -0
  99. package/docs/layouts/shortcodes/version.html +1 -0
  100. package/docs/static/examples/counter/counter-test.html +0 -4
  101. package/docs/static/examples/eventbus/eventbus-test.html +0 -4
  102. package/docs/static/examples/ng-bind/ng-bind.html +2 -2
  103. package/docs/static/examples/ng-non-bindable/ng-non-bindable-test.html +13 -0
  104. package/docs/static/examples/ng-non-bindable/ng-non-bindable.html +3 -0
  105. package/docs/static/examples/ng-non-bindable/ng-non-bindable.test.js +11 -0
  106. package/docs/static/typedoc/assets/hierarchy.js +1 -1
  107. package/docs/static/typedoc/assets/highlight.css +6 -6
  108. package/docs/static/typedoc/assets/navigation.js +1 -1
  109. package/docs/static/typedoc/assets/search.js +1 -1
  110. package/docs/static/typedoc/classes/Location.html +55 -0
  111. package/docs/static/typedoc/classes/LocationProvider.html +20 -0
  112. package/docs/static/typedoc/classes/NgModule.html +32 -0
  113. package/docs/static/typedoc/classes/TemplateCacheProvider.html +1 -1
  114. package/docs/static/typedoc/hierarchy.html +1 -1
  115. package/docs/static/typedoc/index.html +1 -1
  116. package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
  117. package/docs/static/typedoc/interfaces/Directive.html +5 -4
  118. package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
  119. package/docs/static/typedoc/interfaces/HttpProviderDefaults.html +1 -1
  120. package/docs/static/typedoc/interfaces/HttpResponse.html +2 -3
  121. package/docs/static/typedoc/interfaces/Provider.html +16 -10
  122. package/docs/static/typedoc/interfaces/RequestConfig.html +1 -1
  123. package/docs/static/typedoc/interfaces/RequestShortcutConfig.html +1 -1
  124. package/docs/static/typedoc/interfaces/TemplateCache.html +7 -0
  125. package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
  126. package/docs/static/typedoc/types/AnnotatedDirectiveFactory.html +1 -0
  127. package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
  128. package/docs/static/typedoc/types/DirectiveFactory.html +1 -2
  129. package/docs/static/typedoc/types/DirectiveFactoryFn.html +1 -0
  130. package/docs/static/typedoc/types/Expression.html +1 -1
  131. package/docs/static/typedoc/types/HttpResponseStatus.html +1 -0
  132. package/docs/static/typedoc/types/{TemplateCache.html → SwapModeType.html} +1 -1
  133. package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
  134. package/docs/static/typedoc/variables/SwapMode.html +11 -0
  135. package/docs/static/version.js +13 -0
  136. package/docs/test-results/.last-run.json +4 -0
  137. package/docs/test-results/static-examples-counter-counter-counter-example/error-context.md +50 -0
  138. package/legacy.d.ts +0 -10
  139. package/package.json +1 -3
  140. package/src/{loader.js → angular.js} +5 -10
  141. package/src/angular.spec.js +189 -21
  142. package/src/animations/animate-children-directive.js +2 -2
  143. package/src/animations/animate-css.js +17 -18
  144. package/src/animations/animate.spec.js +1 -1
  145. package/src/animations/raf-scheduler.js +1 -1
  146. package/src/animations/shared.js +2 -12
  147. package/src/binding.spec.js +1 -1
  148. package/src/core/compile/attributes.js +1 -1
  149. package/src/core/compile/compile.js +7 -10
  150. package/src/core/compile/compile.spec.js +1 -1
  151. package/src/core/controller/controller.spec.js +1 -1
  152. package/src/core/controller/controller.test.js +1 -0
  153. package/src/core/di/injector.js +11 -25
  154. package/src/core/di/injector.spec.js +2 -2
  155. package/src/core/di/injector.test.js +2 -2
  156. package/src/core/di/internal-injector.js +7 -7
  157. package/src/core/di/ng-module.js +12 -27
  158. package/src/core/filter/filter.js +28 -28
  159. package/src/core/filter/filter.spec.js +1 -1
  160. package/src/core/filter/filter.test.js +1 -0
  161. package/src/core/interpolate/interpolate.js +4 -6
  162. package/src/core/interpolate/interpolate.spec.js +1 -1
  163. package/src/core/interpolate/interpolate.test.js +1 -0
  164. package/src/core/parse/ast/ast.spec.js +1 -1
  165. package/src/core/parse/ast/ast.test.js +1 -1
  166. package/src/core/parse/interpreter.js +32 -38
  167. package/src/core/parse/lexer/lexer.spec.js +1 -1
  168. package/src/core/parse/parse.js +150 -146
  169. package/src/core/parse/parse.spec.js +17 -16
  170. package/src/core/prop.spec.js +1 -1
  171. package/src/core/root-element.spec.js +1 -1
  172. package/src/core/sanitize/sanitize-uri.js +3 -3
  173. package/src/core/scope/scope.js +12 -13
  174. package/src/core/scope/scope.spec.js +3 -4
  175. package/src/directive/aria/aria.spec.js +1 -1
  176. package/src/directive/aria/aria.test.js +1 -0
  177. package/src/directive/attrs/attrs.js +7 -4
  178. package/src/directive/attrs/attrs.spec.js +1 -1
  179. package/src/directive/attrs/attrs.test.js +1 -0
  180. package/src/directive/attrs/boolean.spec.js +1 -1
  181. package/src/directive/attrs/boolean.test.js +1 -0
  182. package/src/directive/attrs/element-style.spec.js +1 -1
  183. package/src/directive/attrs/element-style.test.js +1 -0
  184. package/src/directive/attrs/src.spec.js +1 -1
  185. package/src/directive/attrs/src.test.js +1 -0
  186. package/src/directive/bind/bind-html.spec.js +1 -1
  187. package/src/directive/bind/bind.js +1 -0
  188. package/src/directive/bind/bind.spec.js +1 -1
  189. package/src/directive/bind/bind.test.js +1 -0
  190. package/src/directive/channel/channel.spec.js +1 -1
  191. package/src/directive/channel/channel.test.js +1 -0
  192. package/src/directive/class/class.spec.js +1 -1
  193. package/src/directive/class/class.test.js +1 -0
  194. package/src/directive/cloak/cloak.spec.js +1 -1
  195. package/src/directive/cloak/cloak.test.js +1 -0
  196. package/src/directive/controller/controller.spec.js +1 -1
  197. package/src/directive/controller/controller.test.js +1 -0
  198. package/src/directive/events/click.spec.js +1 -1
  199. package/src/directive/events/event.spec.js +1 -1
  200. package/src/directive/events/events.js +6 -2
  201. package/src/directive/events/events.test.js +1 -0
  202. package/src/directive/form/form.js +8 -5
  203. package/src/directive/form/form.spec.js +1 -1
  204. package/src/directive/form/form.test.js +1 -0
  205. package/src/directive/http/delete.spec.js +3 -1
  206. package/src/directive/http/form-test.html +18 -0
  207. package/src/directive/http/get.spec.js +281 -4
  208. package/src/directive/http/http.js +112 -15
  209. package/src/directive/http/http.test.js +2 -2
  210. package/src/directive/http/post.spec.js +506 -9
  211. package/src/directive/http/put.spec.js +3 -1
  212. package/src/directive/if/if.spec.js +1 -1
  213. package/src/directive/include/include.js +7 -7
  214. package/src/directive/include/include.spec.js +1 -1
  215. package/src/directive/init/init.spec.js +1 -1
  216. package/src/directive/init/init.test.js +1 -0
  217. package/src/directive/input/input.js +19 -43
  218. package/src/directive/input/input.spec.js +1 -2
  219. package/src/directive/input/input.test.js +1 -0
  220. package/src/directive/messages/messages.js +4 -0
  221. package/src/directive/messages/messages.spec.js +1 -1
  222. package/src/directive/messages/messages.test.js +1 -0
  223. package/src/directive/model/model.js +14 -14
  224. package/src/directive/model/model.spec.js +1 -1
  225. package/src/directive/model/model.test.js +1 -0
  226. package/src/directive/model-options/model-option.test.js +1 -0
  227. package/src/directive/model-options/model-options.js +1 -1
  228. package/src/directive/model-options/model-options.spec.js +1 -1
  229. package/src/directive/non-bindable/non-bindable.spec.js +1 -1
  230. package/src/directive/non-bindable/non-bindable.test.js +1 -0
  231. package/src/directive/observe/observe.spec.js +1 -1
  232. package/src/directive/observe/observe.test.js +1 -0
  233. package/src/directive/on/on.spec.js +1 -1
  234. package/src/directive/on/on.test.js +1 -0
  235. package/src/directive/options/options.js +454 -464
  236. package/src/directive/options/options.spec.js +1 -1
  237. package/src/directive/options/options.test.js +1 -0
  238. package/src/directive/ref/href.spec.js +1 -1
  239. package/src/directive/ref/href.test.js +2 -0
  240. package/src/directive/ref/ref.spec.js +1 -1
  241. package/src/directive/repeat/repeat.spec.js +2 -3
  242. package/src/directive/repeat/repeat.test.js +1 -0
  243. package/src/directive/script/script.spec.js +1 -1
  244. package/src/directive/script/script.test.js +1 -0
  245. package/src/directive/select/select.js +1 -1
  246. package/src/directive/select/select.spec.js +1 -1
  247. package/src/directive/select/select.test.js +1 -0
  248. package/src/directive/setter/setter.js +12 -14
  249. package/src/directive/setter/setter.spec.js +40 -17
  250. package/src/directive/setter/setter.test.js +1 -0
  251. package/src/directive/show-hide/show-hide.spec.js +1 -1
  252. package/src/directive/show-hide/show-hide.test.js +1 -0
  253. package/src/directive/style/style.spec.js +1 -1
  254. package/src/directive/style/style.test.js +1 -0
  255. package/src/directive/switch/switch.js +1 -0
  256. package/src/directive/switch/switch.spec.js +1 -1
  257. package/src/directive/switch/switch.test.js +1 -0
  258. package/src/directive/transclude/transclude.js +87 -89
  259. package/src/directive/validators/validators.js +82 -84
  260. package/src/directive/validators/validators.spec.js +5 -4
  261. package/src/directive/validators/validators.test.js +1 -0
  262. package/src/filters/filter.spec.js +1 -1
  263. package/src/filters/filters.spec.js +1 -1
  264. package/src/filters/limit-to.js +2 -3
  265. package/src/filters/limit-to.spec.js +1 -1
  266. package/src/filters/order-by.spec.js +1 -1
  267. package/src/index.js +1 -1
  268. package/src/injection-tokens.js +6 -2
  269. package/src/interface.ts +70 -19
  270. package/src/loader.md +0 -155
  271. package/src/{public.js → ng.js} +16 -23
  272. package/src/{public.spec.js → ng.spec.js} +1 -1
  273. package/src/router/directives/state-directives.spec.js +9 -8
  274. package/src/router/directives/view-directive.js +11 -9
  275. package/src/router/directives/view-directive.spec.js +8 -9
  276. package/src/router/{common/common.html → glob/glob.html} +2 -3
  277. package/src/router/{common → glob}/glob.js +5 -0
  278. package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
  279. package/src/router/globals.js +1 -2
  280. package/src/router/path/path-utils.js +5 -0
  281. package/src/router/router-test-hashbang.html +45 -0
  282. package/src/router/services.spec.js +5 -6
  283. package/src/router/state/interface.ts +1 -1
  284. package/src/router/state/state-builder.js +3 -3
  285. package/src/router/state/state-builder.spec.js +1 -1
  286. package/src/router/state/state-object.js +1 -1
  287. package/src/router/state/state-registry.js +2 -3
  288. package/src/router/state/state-service.js +13 -10
  289. package/src/router/state/state.spec.js +23 -22
  290. package/src/router/state/state.test.js +1 -0
  291. package/src/router/state/views.js +1 -1
  292. package/src/router/state-filter.spec.js +1 -1
  293. package/src/router/state-filters.js +15 -11
  294. package/src/router/template-factory.js +5 -4
  295. package/src/router/template-factory.spec.js +1 -1
  296. package/src/router/transition/hook-registry.js +1 -1
  297. package/src/router/transition/transition-service.js +6 -5
  298. package/src/router/transition/transition.js +4 -4
  299. package/src/router/url/url-matcher.js +3 -3
  300. package/src/router/url/url-rule.js +1 -0
  301. package/src/router/url/url-rules.js +8 -5
  302. package/src/router/url/url-service.js +82 -85
  303. package/src/router/url/url-service.spec.js +55 -39
  304. package/src/router/url/url.test.js +1 -0
  305. package/src/router/view/view.js +4 -5
  306. package/src/router/view/view.spec.js +10 -12
  307. package/src/router/view/view.test.js +1 -0
  308. package/src/router/view-hook.spec.js +1 -1
  309. package/src/router/view-scroll.spec.js +1 -1
  310. package/src/services/anchor-scroll.html +2 -9
  311. package/src/services/anchor-scroll.js +6 -5
  312. package/src/{core → services/exception}/exception-handler.js +2 -2
  313. package/src/{core/error-handler.ts → services/exception/interface.ts} +1 -1
  314. package/src/services/http/http.js +11 -17
  315. package/src/services/http/http.spec.js +2 -7
  316. package/src/services/http/interface.ts +2 -2
  317. package/src/services/http/template-request.spec.js +1 -1
  318. package/src/services/http-backend/http-backend.js +53 -89
  319. package/src/services/http-backend/http-backend.spec.js +2 -6
  320. package/src/services/http-backend/http-backend.test.js +1 -0
  321. package/src/services/location/interface.ts +70 -0
  322. package/src/{core → services}/location/location.html +4 -1
  323. package/src/services/location/location.js +999 -0
  324. package/src/{core → services}/location/location.spec.js +911 -532
  325. package/src/{core → services}/location/location.test.js +2 -2
  326. package/src/services/log/log.spec.js +1 -1
  327. package/src/services/log/log.test.js +1 -0
  328. package/src/services/pubsub/pubsub.spec.js +1 -1
  329. package/src/{core → services}/sce/sce.html +1 -1
  330. package/src/{core → services}/sce/sce.js +14 -10
  331. package/src/{core → services}/sce/sce.md +2 -2
  332. package/src/{core → services}/sce/sce.spec.js +3 -4
  333. package/src/{core → services}/sce/sce.test.js +1 -1
  334. package/src/services/template-cache/interface.ts +8 -2
  335. package/src/services/template-cache/template-cache.js +3 -1
  336. package/src/services/template-cache/template-cache.spec.js +73 -1
  337. package/src/services/template-cache/template-cache.test.js +1 -0
  338. package/src/services/template-request.js +2 -1
  339. package/src/shared/cache.js +0 -2
  340. package/src/shared/common.js +0 -5
  341. package/src/shared/common.spec.js +1 -1
  342. package/src/shared/dom.js +10 -0
  343. package/src/shared/interface.ts +0 -4
  344. package/src/{router/common → shared}/queue.js +7 -7
  345. package/src/shared/shared.html +1 -0
  346. package/src/shared/shared.test.js +1 -0
  347. package/src/shared/test-utils.js +1 -0
  348. package/src/shared/url-utils/interface.ts +54 -0
  349. package/src/{core → shared}/url-utils/url-utils.html +4 -1
  350. package/src/{core → shared}/url-utils/url-utils.js +26 -47
  351. package/src/{core → shared}/url-utils/url-utils.spec.js +10 -17
  352. package/src/{core → shared}/url-utils/url-utils.test.js +1 -1
  353. package/src/shared/utils.js +60 -9
  354. package/src/shared/utils.spec.js +35 -1
  355. package/src/src.html +1 -2
  356. package/typedoc.json +0 -1
  357. package/utils/express.js +36 -2
  358. package/utils/version.cjs +23 -0
  359. package/@types/core/location/location.d.ts +0 -317
  360. package/@types/core/task-tracker-factory.d.ts +0 -76
  361. package/@types/core/url-utils/url-utils.d.ts +0 -56
  362. package/@types/router/state-provider.d.ts +0 -123
  363. package/@types/services/browser.d.ts +0 -101
  364. package/docs/static/typedoc/types/SwapInsertPosition.html +0 -2
  365. package/jsdoc.json +0 -22
  366. package/src/core/location/location.js +0 -984
  367. package/src/core/location/location.md +0 -114
  368. package/src/core/task-tracker-factory.js +0 -145
  369. package/src/core/url-utils/url-utils.md +0 -46
  370. package/src/directive/non-bindable/non-bindable.md +0 -17
  371. package/src/loader.spec.js +0 -169
  372. package/src/router/state-provider.js +0 -146
  373. package/src/services/browser.js +0 -212
  374. /package/@types/{loader.d.ts → angular.d.ts} +0 -0
  375. /package/src/router/{common → glob}/glob.spec.js +0 -0
  376. /package/src/{router/common → shared}/queue.spec.js +0 -0
@@ -3,14 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8" />
5
5
  <title>AngularTS Test Runner</title>
6
-
7
6
  <link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
8
-
9
- <!--
10
- <script src="https://cdn.jsdelivr.net/npm/angular@1.8.3/angular.js"></script>
11
- <script src="https://cdn.jsdelivr.net/npm/angular-animate@1.8.3/angular-animate.js"></script>
12
- <script>window.angular.module("test", [])</script> -->
13
-
14
7
  <script type="module" src="/src/index.js"></script>
15
8
  <script>
16
9
  document.addEventListener("DOMContentLoaded", () => {
@@ -30,10 +23,10 @@
30
23
  $scope.gotoAnchor = function (x) {
31
24
  window.$locationTest = $location;
32
25
  const newHash = "anchor" + x;
33
- if ($location.hash() !== newHash) {
26
+ if ($location.getHash() !== newHash) {
34
27
  // set the $location.hash to `newHash` and
35
28
  // $anchorScroll will automatically scroll to it
36
- $location.hash("anchor" + x);
29
+ $location.setHash("anchor" + x);
37
30
  } else {
38
31
  // call $anchorScroll() explicitly,
39
32
  // since $location.hash hasn't changed
@@ -5,6 +5,7 @@ import {
5
5
  isString,
6
6
  getNodeName,
7
7
  } from "../shared/utils.js";
8
+ import { $injectTokens as $t } from "../injection-tokens.js";
8
9
 
9
10
  /**
10
11
  * @typedef {Object} AnchorScrollObject
@@ -25,11 +26,11 @@ export class AnchorScrollProvider {
25
26
  }
26
27
 
27
28
  $get = [
28
- "$location",
29
- "$rootScope",
29
+ $t.$location,
30
+ $t.$rootScope,
30
31
  /**
31
32
  *
32
- * @param {import('../core/location/location.js').Location} $location
33
+ * @param {import('../services/location/location.js').Location} $location
33
34
  * @param {import('../core/scope/scope.js').Scope} $rootScope
34
35
  * @returns
35
36
  */
@@ -104,7 +105,7 @@ export class AnchorScrollProvider {
104
105
  ? hash
105
106
  : isNumber(hash)
106
107
  ? hash.toString()
107
- : $location.hash();
108
+ : $location.getHash();
108
109
  let elm;
109
110
 
110
111
  // empty hash, scroll to the top of the page
@@ -121,7 +122,7 @@ export class AnchorScrollProvider {
121
122
  };
122
123
 
123
124
  // does not scroll when user clicks on anchor link that is currently on
124
- // (no url change, no $location.hash() change), browser native does scroll
125
+ // (no url change, no $location.getHash() change), browser native does scroll
125
126
  if (this.autoScrollingEnabled) {
126
127
  $rootScope["$location"] = $location;
127
128
  $rootScope.$watch("$location.$$hash", (newVal, oldVal) => {
@@ -42,9 +42,9 @@
42
42
  * @see {@link angular.ErrorHandler AngularTS ErrorHandler}
43
43
  */
44
44
 
45
- /** @typedef {import('../services/log/interface.ts').LogService} LogService */
45
+ /** @typedef {import('../log/interface.ts').LogService} LogService */
46
46
 
47
- /** @typedef {import("./error-handler.ts").ErrorHandler} ErrorHandler */
47
+ /** @typedef {import("./interface.ts").Interface} ErrorHandler */
48
48
 
49
49
  /**
50
50
  * Provider for `$exceptionHandler` service. Delegates uncaught exceptions to `$log.error()` by default.
@@ -4,4 +4,4 @@
4
4
  * @param exception - The exception associated with the error.
5
5
  * @param [cause] - Optional information about the context in which the error was thrown.
6
6
  */
7
- export type ErrorHandler = (exception: Error, cause?: string) => void;
7
+ export type Interface = (exception: Error, cause?: string) => void;
@@ -1,4 +1,4 @@
1
- import { urlIsAllowedOriginFactory } from "../../core/url-utils/url-utils.js";
1
+ import { urlIsAllowedOriginFactory } from "../../shared/url-utils/url-utils.js";
2
2
  import {
3
3
  minErr,
4
4
  isObject,
@@ -291,6 +291,7 @@ export function HttpProvider() {
291
291
  });
292
292
 
293
293
  let useApplyAsync = false;
294
+
294
295
  /**
295
296
  * Configure $http service to combine processing of multiple http responses received at around
296
297
  * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in
@@ -323,7 +324,7 @@ export function HttpProvider() {
323
324
  *
324
325
  * {@link ng.$http#interceptors Interceptors detailed info}
325
326
  */
326
- const interceptorFactories = (this.interceptors = []);
327
+ this.interceptors = [];
327
328
 
328
329
  /**
329
330
  * Array containing URLs whose origins are trusted to receive the XSRF token. See the
@@ -360,8 +361,10 @@ export function HttpProvider() {
360
361
  * $http.get('https://stats.example.com/activity').then(...);
361
362
  * }]);
362
363
  * ```
364
+ *
365
+ * @type {string[]}
363
366
  */
364
- const xsrfTrustedOrigins = (this.xsrfTrustedOrigins = []);
367
+ this.xsrfTrustedOrigins = [];
365
368
 
366
369
  /**
367
370
  * This property is deprecated. Use {@link $httpProvider#xsrfTrustedOrigins xsrfTrustedOrigins}
@@ -377,21 +380,17 @@ export function HttpProvider() {
377
380
  });
378
381
 
379
382
  this.$get = [
380
- "$browser",
381
383
  "$httpBackend",
382
- "$rootScope",
383
384
  "$injector",
384
385
  "$sce",
385
386
  /**
386
387
  *
387
- * @param {*} $browser
388
388
  * @param {*} $httpBackend
389
- * @param {import("../../core/scope/scope.js").Scope} $rootScope
390
389
  * @param {import("../../core/di/internal-injector.js").InjectorService} $injector
391
390
  * @param {*} $sce
392
391
  * @returns
393
392
  */
394
- function ($browser, $httpBackend, $rootScope, $injector, $sce) {
393
+ function ($httpBackend, $injector, $sce) {
395
394
  /**
396
395
  * @type {Map<string, string>}
397
396
  */
@@ -411,7 +410,7 @@ export function HttpProvider() {
411
410
  */
412
411
  const reversedInterceptors = [];
413
412
 
414
- interceptorFactories.forEach((interceptorFactory) => {
413
+ this.interceptors.forEach((interceptorFactory) => {
415
414
  reversedInterceptors.unshift(
416
415
  isString(interceptorFactory)
417
416
  ? $injector.get(interceptorFactory)
@@ -422,7 +421,9 @@ export function HttpProvider() {
422
421
  /**
423
422
  * A function to check request URLs against a list of allowed origins.
424
423
  */
425
- const urlIsAllowedOrigin = urlIsAllowedOriginFactory(xsrfTrustedOrigins);
424
+ const urlIsAllowedOrigin = urlIsAllowedOriginFactory(
425
+ this.xsrfTrustedOrigins,
426
+ );
426
427
 
427
428
  /**
428
429
  * @property {Array.<Object>} requestConfig Array of config objects for currently pending
@@ -461,8 +462,6 @@ export function HttpProvider() {
461
462
  ? $injector.get(config.paramSerializer)
462
463
  : config.paramSerializer;
463
464
 
464
- $browser.$$incOutstandingRequestCount("$http");
465
-
466
465
  const requestInterceptors = [];
467
466
  const responseInterceptors = [];
468
467
  let promise = Promise.resolve(config);
@@ -486,7 +485,6 @@ export function HttpProvider() {
486
485
  promise = chainInterceptors(promise, requestInterceptors);
487
486
  promise = promise.then(serverRequest);
488
487
  promise = chainInterceptors(promise, responseInterceptors);
489
- promise = promise.finally(completeOutstandingRequest);
490
488
 
491
489
  return promise;
492
490
 
@@ -503,10 +501,6 @@ export function HttpProvider() {
503
501
  return promise;
504
502
  }
505
503
 
506
- function completeOutstandingRequest() {
507
- $browser.$$completeOutstandingRequest(() => {}, "$http");
508
- }
509
-
510
504
  function executeHeaderFns(headers, config) {
511
505
  let headerContent;
512
506
  const processedHeaders = {};
@@ -1,6 +1,6 @@
1
1
  import { createInjector } from "../../core/di/injector.js";
2
2
  import { isObject } from "../../shared/utils.js";
3
- import { Angular } from "../../loader.js";
3
+ import { Angular } from "../../angular.js";
4
4
  import { wait } from "../../shared/test-utils.js";
5
5
 
6
6
  export function getLastAjaxRequest() {
@@ -238,12 +238,7 @@ describe("$http", function () {
238
238
  });
239
239
  expect(response.headers).toBeDefined();
240
240
  expect(response.headers instanceof Function).toBe(true);
241
- expect(response.headers("Content-Type")).toBe(
242
- "application/json; charset=utf-8",
243
- );
244
- expect(response.headers("content-type")).toBe(
245
- "application/json; charset=utf-8",
246
- );
241
+ expect(response.headers("Content-Type")).toBe("text/html; charset=utf-8");
247
242
  });
248
243
 
249
244
  it("may returns all response headers", async function () {
@@ -139,14 +139,14 @@ export interface RequestConfig extends RequestShortcutConfig {
139
139
  | undefined;
140
140
  }
141
141
 
142
+ export type HttpResponseStatus = "complete" | "error" | "timeout" | "abort";
142
143
  export interface HttpResponse<T> {
143
144
  data: T;
144
145
  status: number;
145
146
  headers: HttpHeadersGetter;
146
147
  config: RequestConfig;
147
148
  statusText: string;
148
- /** Added in AngularJS 1.6.6 */
149
- xhrStatus: "complete" | "error" | "timeout" | "abort";
149
+ xhrStatus: HttpResponseStatus;
150
150
  }
151
151
 
152
152
  export type HttpPromise<T> = Promise<HttpResponse<T>>;
@@ -1,5 +1,5 @@
1
1
  import { createInjector } from "../../core/di/injector.js";
2
- import { Angular } from "../../loader.js";
2
+ import { Angular } from "../../angular.js";
3
3
  import { wait } from "../../shared/test-utils.js";
4
4
 
5
5
  describe("$templateRequest", () => {
@@ -1,43 +1,36 @@
1
- import { urlResolve } from "../../core/url-utils/url-utils.js";
1
+ import { trimEmptyHash } from "../../shared/url-utils/url-utils.js";
2
2
  import { isDefined, isPromiseLike, isUndefined } from "../../shared/utils.js";
3
3
 
4
4
  /**
5
- * HTTP backend used by the {@link ng.$http service} that delegates to
5
+ * HTTP backend used by the `$http` that delegates to
6
6
  * XMLHttpRequest object and deals with browser incompatibilities.
7
- *
8
- * You should never need to use this service directly, instead use the higher-level abstractions:
9
- * {@link ng.$http $http}.
10
- *
11
- */
12
- /**
13
- * HTTP backend used by the {@link ng.$http service} that delegates to
14
- * XMLHttpRequest object and deals with browser incompatibilities.
15
- *
16
- * You should never need to use this service directly, instead use the higher-level abstractions:
17
- * {@link ng.$http $http}.
18
- *
7
+ * You should never need to use this service directly.
19
8
  */
20
9
  export class HttpBackendProvider {
21
10
  constructor() {
22
- this.$get = [
23
- "$browser",
24
- /**
25
- * @param {import('../browser.js').Browser} $browser
26
- * @returns
27
- */
28
- function ($browser) {
29
- return createHttpBackend($browser);
30
- },
31
- ];
11
+ this.$get = () => createHttpBackend();
32
12
  }
33
13
  }
34
14
 
35
15
  /**
36
- * @param {import('../browser.js').Browser} $browser
37
16
  * @returns
38
17
  */
39
- export function createHttpBackend($browser) {
40
- // TODO(vojta): fix the signature
18
+ export function createHttpBackend() {
19
+ /**
20
+ * Makes an HTTP request using XMLHttpRequest with flexible options.
21
+ *
22
+ * @param {string} method - The HTTP method (e.g., "GET", "POST").
23
+ * @param {string} [url] - The URL to send the request to. Defaults to the current page URL.
24
+ * @param {*} [post] - The body to send with the request, if any.
25
+ * @param {function(number, any, string|null, string, string): void} [callback] - Callback invoked when the request completes.
26
+ * @param {Object<string, string|undefined>} [headers] - Headers to set on the request.
27
+ * @param {number|Promise<any>} [timeout] - Timeout in ms or a cancellable promise.
28
+ * @param {boolean} [withCredentials] - Whether to send credentials with the request.
29
+ * @param {XMLHttpRequestResponseType} [responseType] - The type of data expected in the response.
30
+ * @param {Object<string, EventListener>} [eventHandlers] - Event listeners for the XMLHttpRequest object.
31
+ * @param {Object<string, EventListener>} [uploadEventHandlers] - Event listeners for the XMLHttpRequest.upload object.
32
+ * @returns {void}
33
+ */
41
34
  return function (
42
35
  method,
43
36
  url,
@@ -50,38 +43,35 @@ export function createHttpBackend($browser) {
50
43
  eventHandlers,
51
44
  uploadEventHandlers,
52
45
  ) {
53
- url = url || $browser.url();
46
+ url = url || trimEmptyHash(window.location.href);
54
47
 
55
48
  const xhr = new XMLHttpRequest();
56
49
  let abortedByTimeout = false;
50
+ let timeoutId;
57
51
 
58
52
  xhr.open(method, url, true);
53
+
59
54
  if (headers) {
60
- Object.entries(headers).forEach(([key, value]) => {
55
+ for (const [key, value] of Object.entries(headers)) {
61
56
  if (isDefined(value)) {
62
57
  xhr.setRequestHeader(key, value);
63
58
  }
64
- });
59
+ }
65
60
  }
66
61
 
67
- xhr.onload = function () {
62
+ xhr.onload = () => {
63
+ let status = xhr.status || 0;
68
64
  const statusText = xhr.statusText || "";
69
65
 
70
- let status = xhr.status;
71
-
72
- // fix status code when it is 0 (0 status is undocumented).
73
- // Occurs when accessing file resources or on Android 4.1 stock browser
74
- // while retrieving files from application cache.
75
66
  if (status === 0) {
76
67
  status = xhr.response
77
68
  ? 200
78
- : urlResolve(url).protocol === "file"
69
+ : new URL(url).protocol === "file:"
79
70
  ? 404
80
71
  : 0;
81
72
  }
82
73
 
83
74
  completeRequest(
84
- callback,
85
75
  status,
86
76
  xhr.response,
87
77
  xhr.getAllResponseHeaders(),
@@ -90,20 +80,11 @@ export function createHttpBackend($browser) {
90
80
  );
91
81
  };
92
82
 
93
- xhr.onerror = function () {
94
- // The response is always empty
95
- // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error
96
- completeRequest(callback, -1, null, null, "", "error");
97
- };
98
- xhr.ontimeout = function () {
99
- // The response is always empty
100
- // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error
101
- completeRequest(callback, -1, null, null, "", "timeout");
102
- };
83
+ xhr.onerror = () => completeRequest(-1, null, null, "", "error");
84
+ xhr.ontimeout = () => completeRequest(-1, null, null, "", "timeout");
103
85
 
104
- xhr.onabort = function () {
86
+ xhr.onabort = () => {
105
87
  completeRequest(
106
- callback,
107
88
  -1,
108
89
  null,
109
90
  null,
@@ -113,16 +94,15 @@ export function createHttpBackend($browser) {
113
94
  };
114
95
 
115
96
  if (eventHandlers) {
116
- eventHandlers &&
117
- Object.entries(eventHandlers).forEach(([key, value]) => {
118
- xhr.addEventListener(key, value);
119
- });
97
+ for (const [key, handler] of Object.entries(eventHandlers)) {
98
+ xhr.addEventListener(key, handler);
99
+ }
120
100
  }
121
101
 
122
102
  if (uploadEventHandlers) {
123
- Object.entries(uploadEventHandlers).forEach(([key, value]) => {
124
- xhr.upload.addEventListener(key, value);
125
- });
103
+ for (const [key, handler] of Object.entries(uploadEventHandlers)) {
104
+ xhr.upload.addEventListener(key, handler);
105
+ }
126
106
  }
127
107
 
128
108
  if (withCredentials) {
@@ -133,61 +113,45 @@ export function createHttpBackend($browser) {
133
113
  try {
134
114
  xhr.responseType = responseType;
135
115
  } catch (e) {
136
- // WebKit added support for the json responseType value on 09/03/2013
137
- // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
138
- // known to throw when setting the value "json" as the response type. Other older
139
- // browsers implementing the responseType
140
- //
141
- // The json response type can be ignored if not supported, because JSON payloads are
142
- // parsed on the client-side regardless.
143
- if (responseType !== "json") {
144
- throw e;
145
- }
116
+ if (responseType !== "json") throw e;
146
117
  }
147
118
  }
148
119
 
149
120
  xhr.send(isUndefined(post) ? null : post);
150
121
 
151
- // Since we are using xhr.abort() when a request times out, we have to set a flag that
152
- // indicates to requestAborted if the request timed out or was aborted.
153
- //
154
- // http.timeout = numerical timeout timeout
155
- // http.timeout = $timeout timeout
156
- // http.timeout = promise abort
157
- // xhr.abort() abort (The xhr object is normally inaccessible, but
158
- // can be exposed with the xhrFactory)
159
- /** @type {number} */
160
- let timeoutId;
161
- if (timeout > 0) {
162
- timeoutId = setTimeout(() => {
163
- timeoutRequest("timeout");
164
- }, timeout);
122
+ if (typeof timeout === "number" && timeout > 0) {
123
+ timeoutId = setTimeout(() => timeoutRequest("timeout"), timeout);
165
124
  } else if (isPromiseLike(timeout)) {
166
- timeout.then(() => {
167
- timeoutRequest(isDefined(timeout.$$timeoutId) ? "timeout" : "abort");
125
+ /** @type {Promise} */ (timeout).then(() => {
126
+ timeoutRequest(isDefined(timeout["$$timeoutId"]) ? "timeout" : "abort");
168
127
  });
169
128
  }
170
129
 
130
+ /**
131
+ * @param {"timeout"|"abort"} reason
132
+ */
171
133
  function timeoutRequest(reason) {
172
134
  abortedByTimeout = reason === "timeout";
173
- if (xhr) {
174
- xhr.abort();
175
- }
135
+ if (xhr) xhr.abort();
176
136
  }
177
137
 
138
+ /**
139
+ * @param {number} status - HTTP status code or -1 for network errors.
140
+ * @param {*} response - The parsed or raw response from the server.
141
+ * @param {string|null} headersString - The raw response headers as a string.
142
+ * @param {string} statusText - The status text returned by the server.
143
+ * @param {"complete"|"error"|"timeout"|"abort"} xhrStatus - Final status of the request.
144
+ */
178
145
  function completeRequest(
179
- callback,
180
146
  status,
181
147
  response,
182
148
  headersString,
183
149
  statusText,
184
150
  xhrStatus,
185
151
  ) {
186
- // cancel timeout and subsequent timeout promise resolution
187
152
  if (isDefined(timeoutId)) {
188
153
  clearTimeout(timeoutId);
189
154
  }
190
-
191
155
  callback(status, response, headersString, statusText, xhrStatus);
192
156
  }
193
157
  };
@@ -1,11 +1,9 @@
1
- import { createInjector } from "../../core/di/injector.js";
2
- import { Angular } from "../../loader.js";
1
+ import { Angular } from "../../angular.js";
3
2
  import { createHttpBackend } from "./http-backend.js";
4
3
  import sinon from "sinon";
5
4
 
6
5
  describe("$httpBackend", () => {
7
6
  let $backend;
8
- let $browser;
9
7
  let xhr;
10
8
  let callback;
11
9
  let requests;
@@ -18,9 +16,7 @@ describe("$httpBackend", () => {
18
16
  requests.push(req);
19
17
  };
20
18
  angular = window.angular = new Angular();
21
- let $injector = createInjector(["ng"]);
22
- $browser = $injector.get("$browser");
23
- $backend = createHttpBackend($browser);
19
+ $backend = createHttpBackend();
24
20
  callback = jasmine.createSpy("done");
25
21
  });
26
22
 
@@ -5,6 +5,7 @@ const TEST_URL = "src/services/http-backend/http-backend.html";
5
5
  test("unit tests contain no errors", async ({ page }) => {
6
6
  await page.goto(TEST_URL);
7
7
  await page.content();
8
+ await page.waitForTimeout(1000);
8
9
  await expect(page.locator(".jasmine-overall-result")).toHaveText(
9
10
  /0 failures/,
10
11
  );
@@ -0,0 +1,70 @@
1
+ /**
2
+ * A callback function that gets called when the browser URL or state changes.
3
+ *
4
+ * @param url - The new URL after the change (with trailing `#` removed).
5
+ * @param state - The new history state associated with the URL (`history.state`).
6
+ * @returns void
7
+ */
8
+ export type UrlChangeListener = (url: string, state: History["state"]) => void;
9
+
10
+ /**
11
+ * Represents the configuration options for HTML5 mode.
12
+ */
13
+ export interface Html5Mode {
14
+ /**
15
+ * If true, will rely on `history.pushState` to change URLs where supported.
16
+ * Falls back to hash-prefixed paths in browsers that do not support `pushState`.
17
+ * @default false
18
+ */
19
+ enabled: boolean;
20
+
21
+ /**
22
+ * When html5Mode is enabled, specifies whether or not a `<base>` tag is required to be present.
23
+ * If both `enabled` and `requireBase` are true, and a `<base>` tag is not present,
24
+ * an error will be thrown when `$location` is injected.
25
+ * @default true
26
+ */
27
+ requireBase: boolean;
28
+
29
+ /**
30
+ * When html5Mode is enabled, enables or disables URL rewriting for relative links.
31
+ * If set to a string, URL rewriting will only apply to links with an attribute that matches the given string.
32
+ * For example, if set to `'internal-link'`, URL rewriting will only occur for `<a internal-link>` links.
33
+ * Attribute name normalization does not apply here.
34
+ * @default true
35
+ */
36
+ rewriteLinks: boolean | string;
37
+ }
38
+
39
+ /**
40
+ * Represents default port numbers for various protocols.
41
+ */
42
+ export interface DefaultPorts {
43
+ http: number;
44
+ https: number;
45
+ ftp: number;
46
+ }
47
+
48
+ /**
49
+ * Represents the individual components of a URL.
50
+ */
51
+ export interface UrlParts {
52
+ /**
53
+ * The URL path (e.g. `/dashboard`, `/users/123`).
54
+ */
55
+ path: string;
56
+
57
+ /**
58
+ * The parsed query string as an object.
59
+ * Mirrors AngularJS’s `$location.setSearch()` format.
60
+ */
61
+ search: Record<
62
+ string,
63
+ string | number | boolean | (string | number | boolean)[]
64
+ >;
65
+
66
+ /**
67
+ * The fragment identifier (everything after `#`, not including the `#` itself).
68
+ */
69
+ hash: string;
70
+ }
@@ -11,7 +11,10 @@
11
11
  <script src="/jasmine/jasmine-html.js"></script>
12
12
  <script src="/jasmine/boot0.js"></script>
13
13
  <script src="/jasmine/boot1.js"></script>
14
- <script type="module" src="/src/core/location/location.spec.js"></script>
14
+ <script
15
+ type="module"
16
+ src="/src/services/location/location.spec.js"
17
+ ></script>
15
18
  </head>
16
19
  <body>
17
20
  <div id="app"></div>