@angular-wave/angular.ts 0.7.8 → 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 (285) hide show
  1. package/@types/core/parse/parse.d.ts +6 -7
  2. package/@types/directive/bind/bind.d.ts +2 -1
  3. package/@types/index.d.ts +1 -1
  4. package/@types/interface.d.ts +3 -1
  5. package/@types/{public.d.ts → ng.d.ts} +2 -2
  6. package/@types/router/globals.d.ts +1 -1
  7. package/@types/router/path/path-utils.d.ts +8 -11
  8. package/@types/router/state/interface.d.ts +1 -1
  9. package/@types/router/state/state-object.d.ts +1 -1
  10. package/@types/router/state/state-service.d.ts +8 -7
  11. package/@types/router/state-filters.d.ts +24 -2
  12. package/@types/router/transition/transition.d.ts +12 -15
  13. package/@types/router/url/url-matcher.d.ts +3 -3
  14. package/@types/router/url/url-rule.d.ts +1 -0
  15. package/@types/router/url/url-rules.d.ts +26 -6
  16. package/@types/router/url/url-service.d.ts +28 -38
  17. package/@types/services/http/http.d.ts +48 -1
  18. package/@types/services/http-backend/http-backend.d.ts +48 -35
  19. package/@types/services/location/interface.d.ts +55 -0
  20. package/@types/services/location/location.d.ts +225 -252
  21. package/@types/shared/common.d.ts +0 -2
  22. package/@types/shared/interface.d.ts +0 -4
  23. package/@types/{router/common → shared}/queue.d.ts +2 -2
  24. package/@types/shared/url-utils/interface.d.ts +0 -1
  25. package/@types/shared/url-utils/url-utils.d.ts +0 -5
  26. package/@types/shared/utils.d.ts +29 -6
  27. package/Makefile +6 -3
  28. package/dist/angular-ts.esm.js +960 -1062
  29. package/dist/angular-ts.umd.js +960 -1062
  30. package/dist/angular-ts.umd.min.js +1 -1
  31. package/docs/assets/scss/index.scss +23 -0
  32. package/docs/content/_index.md +9 -8
  33. package/docs/content/docs/_index.md +1 -1
  34. package/docs/content/docs/directive/app.md +1 -1
  35. package/docs/content/docs/directive/bind.md +1 -1
  36. package/docs/content/docs/directive/blur.md +1 -1
  37. package/docs/content/docs/directive/channel.md +2 -2
  38. package/docs/content/docs/directive/class-even.md +1 -1
  39. package/docs/content/docs/directive/class-odd.md +1 -1
  40. package/docs/content/docs/directive/class.md +1 -1
  41. package/docs/content/docs/directive/click.md +1 -1
  42. package/docs/content/docs/directive/copy.md +1 -1
  43. package/docs/content/docs/directive/cut.md +1 -1
  44. package/docs/content/docs/directive/dblclick.md +1 -1
  45. package/docs/content/docs/directive/focus.md +1 -1
  46. package/docs/content/docs/directive/get.md +3 -3
  47. package/docs/content/docs/directive/keydown.md +1 -1
  48. package/docs/content/docs/directive/keyup.md +1 -1
  49. package/docs/content/docs/directive/load.md +1 -1
  50. package/docs/content/docs/directive/mousedown.md +1 -1
  51. package/docs/content/docs/directive/mouseenter.md +1 -1
  52. package/docs/content/docs/directive/mouseleave.md +1 -1
  53. package/docs/content/docs/directive/mousemove.md +1 -1
  54. package/docs/content/docs/directive/mouseout.md +1 -1
  55. package/docs/content/docs/directive/mouseover.md +1 -1
  56. package/docs/content/docs/directive/mouseup.md +1 -1
  57. package/docs/content/docs/directive/non-bindable.md +28 -0
  58. package/docs/content/docs/provider/locationProvider.md +26 -0
  59. package/docs/content/docs/provider/templateCacheProvider.md +2 -2
  60. package/docs/content/docs/service/location.md +57 -0
  61. package/docs/content/docs/service/url.md +5 -0
  62. package/docs/layouts/partials/hooks/head-end.html +1 -1
  63. package/docs/layouts/shortcodes/version.html +1 -0
  64. package/docs/static/examples/counter/counter-test.html +0 -4
  65. package/docs/static/examples/eventbus/eventbus-test.html +0 -4
  66. package/docs/static/examples/ng-non-bindable/ng-non-bindable-test.html +13 -0
  67. package/docs/static/examples/ng-non-bindable/ng-non-bindable.html +3 -0
  68. package/docs/static/examples/ng-non-bindable/ng-non-bindable.test.js +11 -0
  69. package/docs/static/typedoc/assets/highlight.css +6 -6
  70. package/docs/static/typedoc/assets/navigation.js +1 -1
  71. package/docs/static/typedoc/assets/search.js +1 -1
  72. package/docs/static/typedoc/classes/Location.html +55 -0
  73. package/docs/static/typedoc/classes/LocationProvider.html +20 -0
  74. package/docs/static/typedoc/index.html +1 -1
  75. package/docs/static/typedoc/interfaces/DefaultPorts.html +5 -0
  76. package/docs/static/typedoc/interfaces/Html5Mode.html +23 -0
  77. package/docs/static/typedoc/interfaces/Provider.html +2 -1
  78. package/docs/static/typedoc/interfaces/UrlParts.html +9 -0
  79. package/docs/static/typedoc/types/AnnotatedFactory.html +1 -1
  80. package/docs/static/typedoc/types/Expression.html +1 -1
  81. package/docs/static/typedoc/types/UrlChangeListener.html +5 -0
  82. package/docs/static/version.js +13 -0
  83. package/docs/test-results/.last-run.json +4 -0
  84. package/docs/test-results/static-examples-counter-counter-counter-example/error-context.md +50 -0
  85. package/package.json +1 -1
  86. package/src/{loader.js → angular.js} +1 -1
  87. package/src/angular.spec.js +189 -21
  88. package/src/animations/animate-css.js +17 -18
  89. package/src/animations/animate.spec.js +1 -1
  90. package/src/animations/shared.js +2 -3
  91. package/src/binding.spec.js +1 -1
  92. package/src/core/compile/compile.js +4 -7
  93. package/src/core/compile/compile.spec.js +1 -1
  94. package/src/core/controller/controller.spec.js +1 -1
  95. package/src/core/controller/controller.test.js +1 -0
  96. package/src/core/di/injector.js +7 -8
  97. package/src/core/di/injector.spec.js +2 -2
  98. package/src/core/di/injector.test.js +2 -2
  99. package/src/core/di/internal-injector.js +3 -6
  100. package/src/core/filter/filter.js +1 -1
  101. package/src/core/filter/filter.spec.js +1 -1
  102. package/src/core/filter/filter.test.js +1 -0
  103. package/src/core/interpolate/interpolate.js +4 -6
  104. package/src/core/interpolate/interpolate.spec.js +1 -1
  105. package/src/core/interpolate/interpolate.test.js +1 -0
  106. package/src/core/parse/ast/ast.spec.js +1 -1
  107. package/src/core/parse/ast/ast.test.js +1 -1
  108. package/src/core/parse/lexer/lexer.spec.js +1 -1
  109. package/src/core/parse/parse.js +150 -146
  110. package/src/core/parse/parse.spec.js +17 -16
  111. package/src/core/prop.spec.js +1 -1
  112. package/src/core/root-element.spec.js +1 -1
  113. package/src/core/scope/scope.js +10 -11
  114. package/src/core/scope/scope.spec.js +3 -4
  115. package/src/directive/aria/aria.spec.js +1 -1
  116. package/src/directive/aria/aria.test.js +1 -0
  117. package/src/directive/attrs/attrs.spec.js +1 -1
  118. package/src/directive/attrs/attrs.test.js +1 -0
  119. package/src/directive/attrs/boolean.spec.js +1 -1
  120. package/src/directive/attrs/boolean.test.js +1 -0
  121. package/src/directive/attrs/element-style.spec.js +1 -1
  122. package/src/directive/attrs/element-style.test.js +1 -0
  123. package/src/directive/attrs/src.spec.js +1 -1
  124. package/src/directive/attrs/src.test.js +1 -0
  125. package/src/directive/bind/bind-html.spec.js +1 -1
  126. package/src/directive/bind/bind.js +1 -0
  127. package/src/directive/bind/bind.spec.js +1 -1
  128. package/src/directive/bind/bind.test.js +1 -0
  129. package/src/directive/channel/channel.spec.js +1 -1
  130. package/src/directive/channel/channel.test.js +1 -0
  131. package/src/directive/class/class.spec.js +1 -1
  132. package/src/directive/class/class.test.js +1 -0
  133. package/src/directive/cloak/cloak.spec.js +1 -1
  134. package/src/directive/cloak/cloak.test.js +1 -0
  135. package/src/directive/controller/controller.spec.js +1 -1
  136. package/src/directive/controller/controller.test.js +1 -0
  137. package/src/directive/events/click.spec.js +1 -1
  138. package/src/directive/events/event.spec.js +1 -1
  139. package/src/directive/events/events.test.js +1 -0
  140. package/src/directive/form/form.js +8 -5
  141. package/src/directive/form/form.spec.js +1 -1
  142. package/src/directive/form/form.test.js +1 -0
  143. package/src/directive/http/delete.spec.js +1 -1
  144. package/src/directive/http/form-test.html +18 -0
  145. package/src/directive/http/get.spec.js +1 -1
  146. package/src/directive/http/http.js +12 -3
  147. package/src/directive/http/post.spec.js +504 -9
  148. package/src/directive/http/put.spec.js +1 -1
  149. package/src/directive/if/if.spec.js +1 -1
  150. package/src/directive/include/include.spec.js +1 -1
  151. package/src/directive/init/init.spec.js +1 -1
  152. package/src/directive/init/init.test.js +1 -0
  153. package/src/directive/input/input.js +13 -15
  154. package/src/directive/input/input.spec.js +1 -2
  155. package/src/directive/input/input.test.js +1 -0
  156. package/src/directive/messages/messages.spec.js +1 -1
  157. package/src/directive/messages/messages.test.js +1 -0
  158. package/src/directive/model/model.js +13 -13
  159. package/src/directive/model/model.spec.js +1 -1
  160. package/src/directive/model/model.test.js +1 -0
  161. package/src/directive/model-options/model-option.test.js +1 -0
  162. package/src/directive/model-options/model-options.js +1 -1
  163. package/src/directive/model-options/model-options.spec.js +1 -1
  164. package/src/directive/non-bindable/non-bindable.spec.js +1 -1
  165. package/src/directive/non-bindable/non-bindable.test.js +1 -0
  166. package/src/directive/observe/observe.spec.js +1 -1
  167. package/src/directive/observe/observe.test.js +1 -0
  168. package/src/directive/on/on.spec.js +1 -1
  169. package/src/directive/on/on.test.js +1 -0
  170. package/src/directive/options/options.spec.js +1 -1
  171. package/src/directive/options/options.test.js +1 -0
  172. package/src/directive/ref/href.spec.js +1 -1
  173. package/src/directive/ref/href.test.js +2 -0
  174. package/src/directive/ref/ref.spec.js +1 -1
  175. package/src/directive/repeat/repeat.spec.js +2 -3
  176. package/src/directive/repeat/repeat.test.js +1 -0
  177. package/src/directive/script/script.spec.js +1 -1
  178. package/src/directive/script/script.test.js +1 -0
  179. package/src/directive/select/select.js +1 -1
  180. package/src/directive/select/select.spec.js +1 -1
  181. package/src/directive/select/select.test.js +1 -0
  182. package/src/directive/setter/setter.spec.js +1 -1
  183. package/src/directive/setter/setter.test.js +1 -0
  184. package/src/directive/show-hide/show-hide.spec.js +1 -1
  185. package/src/directive/show-hide/show-hide.test.js +1 -0
  186. package/src/directive/style/style.spec.js +1 -1
  187. package/src/directive/style/style.test.js +1 -0
  188. package/src/directive/switch/switch.spec.js +1 -1
  189. package/src/directive/switch/switch.test.js +1 -0
  190. package/src/directive/validators/validators.js +82 -84
  191. package/src/directive/validators/validators.spec.js +5 -4
  192. package/src/directive/validators/validators.test.js +1 -0
  193. package/src/filters/filter.spec.js +1 -1
  194. package/src/filters/filters.spec.js +1 -1
  195. package/src/filters/limit-to.js +2 -3
  196. package/src/filters/limit-to.spec.js +1 -1
  197. package/src/filters/order-by.spec.js +1 -1
  198. package/src/index.js +1 -1
  199. package/src/injection-tokens.js +5 -1
  200. package/src/interface.ts +3 -1
  201. package/src/loader.md +0 -155
  202. package/src/{public.js → ng.js} +7 -8
  203. package/src/{public.spec.js → ng.spec.js} +1 -1
  204. package/src/router/directives/state-directives.spec.js +8 -7
  205. package/src/router/directives/view-directive.js +2 -8
  206. package/src/router/directives/view-directive.spec.js +8 -9
  207. package/src/router/{common/common.html → glob/glob.html} +2 -3
  208. package/src/router/{common/common.test.js → glob/glob.test.js} +2 -1
  209. package/src/router/globals.js +1 -1
  210. package/src/router/path/path-utils.js +5 -0
  211. package/src/router/router-test-hashbang.html +45 -0
  212. package/src/router/services.spec.js +5 -6
  213. package/src/router/state/interface.ts +1 -1
  214. package/src/router/state/state-builder.js +3 -3
  215. package/src/router/state/state-builder.spec.js +1 -1
  216. package/src/router/state/state-object.js +1 -1
  217. package/src/router/state/state-registry.js +2 -2
  218. package/src/router/state/state-service.js +13 -10
  219. package/src/router/state/state.spec.js +23 -22
  220. package/src/router/state/state.test.js +1 -0
  221. package/src/router/state/views.js +1 -1
  222. package/src/router/state-filter.spec.js +1 -1
  223. package/src/router/state-filters.js +13 -9
  224. package/src/router/template-factory.js +5 -4
  225. package/src/router/template-factory.spec.js +1 -1
  226. package/src/router/transition/hook-registry.js +1 -1
  227. package/src/router/transition/transition-service.js +6 -5
  228. package/src/router/transition/transition.js +4 -4
  229. package/src/router/url/url-matcher.js +3 -3
  230. package/src/router/url/url-rule.js +1 -0
  231. package/src/router/url/url-rules.js +8 -5
  232. package/src/router/url/url-service.js +77 -76
  233. package/src/router/url/url-service.spec.js +55 -39
  234. package/src/router/url/url.test.js +1 -0
  235. package/src/router/view/view.js +4 -5
  236. package/src/router/view/view.spec.js +10 -12
  237. package/src/router/view/view.test.js +1 -0
  238. package/src/router/view-hook.spec.js +1 -1
  239. package/src/router/view-scroll.spec.js +1 -1
  240. package/src/services/anchor-scroll.html +2 -2
  241. package/src/services/anchor-scroll.js +5 -4
  242. package/src/services/http/http.js +9 -4
  243. package/src/services/http/http.spec.js +2 -7
  244. package/src/services/http/template-request.spec.js +1 -1
  245. package/src/services/http-backend/http-backend.js +51 -77
  246. package/src/services/http-backend/http-backend.spec.js +1 -2
  247. package/src/services/http-backend/http-backend.test.js +1 -0
  248. package/src/services/location/interface.ts +62 -0
  249. package/src/services/location/location.js +433 -520
  250. package/src/services/location/location.spec.js +909 -530
  251. package/src/services/location/location.test.js +2 -2
  252. package/src/services/log/log.spec.js +1 -1
  253. package/src/services/log/log.test.js +1 -0
  254. package/src/services/pubsub/pubsub.spec.js +1 -1
  255. package/src/services/sce/sce.js +5 -7
  256. package/src/services/sce/sce.md +2 -2
  257. package/src/services/sce/sce.spec.js +1 -1
  258. package/src/services/template-cache/template-cache.spec.js +1 -1
  259. package/src/services/template-cache/template-cache.test.js +1 -0
  260. package/src/shared/common.js +0 -5
  261. package/src/shared/common.spec.js +1 -1
  262. package/src/shared/interface.ts +0 -4
  263. package/src/{router/common → shared}/queue.js +7 -7
  264. package/src/shared/shared.html +1 -0
  265. package/src/shared/shared.test.js +1 -0
  266. package/src/shared/url-utils/interface.ts +0 -2
  267. package/src/shared/url-utils/url-utils.js +6 -30
  268. package/src/shared/url-utils/url-utils.spec.js +10 -9
  269. package/src/shared/utils.js +32 -9
  270. package/src/shared/utils.spec.js +35 -1
  271. package/src/src.html +1 -2
  272. package/typedoc.json +0 -1
  273. package/utils/express.js +27 -1
  274. package/utils/version.cjs +23 -0
  275. package/@types/router/state-provider.d.ts +0 -123
  276. package/src/directive/non-bindable/non-bindable.md +0 -17
  277. package/src/loader.spec.js +0 -169
  278. package/src/router/state-provider.js +0 -146
  279. package/src/services/location/location.md +0 -114
  280. package/src/shared/url-utils/url-utils.md +0 -46
  281. /package/@types/{loader.d.ts → angular.d.ts} +0 -0
  282. /package/@types/router/{common → glob}/glob.d.ts +0 -0
  283. /package/src/router/{common → glob}/glob.js +0 -0
  284. /package/src/router/{common → glob}/glob.spec.js +0 -0
  285. /package/src/{router/common → shared}/queue.spec.js +0 -0
@@ -4,7 +4,6 @@ import {
4
4
  isNumber,
5
5
  isNumberNaN,
6
6
  isString,
7
- toInt,
8
7
  } from "../shared/utils.js";
9
8
 
10
9
  /**
@@ -23,7 +22,7 @@ export function limitToFilter() {
23
22
  if (Math.abs(Number(limit)) === Infinity) {
24
23
  limit = Number(limit);
25
24
  } else {
26
- limit = toInt(/** @type {string} */ (limit));
25
+ limit = parseInt(/** @type {string} */ (limit), 10);
27
26
  }
28
27
  if (isNumberNaN(limit)) return input;
29
28
 
@@ -33,7 +32,7 @@ export function limitToFilter() {
33
32
  begin =
34
33
  !begin || isNaN(/** @type {any} */ (begin))
35
34
  ? 0
36
- : toInt(/** @type {string} */ (begin));
35
+ : parseInt(/** @type {string} */ (begin), 10);
37
36
  begin =
38
37
  begin < 0 ? Math.max(0, /** @type {[]} */ (input).length + begin) : begin;
39
38
 
@@ -1,4 +1,4 @@
1
- import { Angular } from "../loader.js";
1
+ import { Angular } from "../angular.js";
2
2
  import { createInjector } from "../core/di/injector.js";
3
3
  import { createElementFromHTML } from "../shared/dom.js";
4
4
 
@@ -1,4 +1,4 @@
1
- import { Angular } from "../loader.js";
1
+ import { Angular } from "../angular.js";
2
2
  import { createInjector } from "../core/di/injector.js";
3
3
 
4
4
  describe("Filter: orderBy", () => {
package/src/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { Angular } from "./loader.js";
1
+ import { Angular } from "./angular.js";
2
2
 
3
3
  export const angular = new Angular();
4
4
  document.addEventListener("DOMContentLoaded", () => angular.init(document), {
@@ -16,6 +16,9 @@
16
16
  * @type Readonly<Record<string, string>>
17
17
  */
18
18
  export const $injectTokens = Object.freeze({
19
+ $attrs: "$attrs",
20
+ $scope: "$scope",
21
+ $element: "$element",
19
22
  $$AnimateRunner: "$$AnimateRunner",
20
23
  $$animateAsyncRun: "$$animateAsyncRun",
21
24
  $$animateCache: "$$animateCache",
@@ -44,6 +47,7 @@ export const $injectTokens = Object.freeze({
44
47
  $ngViewScroll: "$ngViewScroll",
45
48
  $parse: "$parse",
46
49
  $rootScope: "$rootScope",
50
+ $rootElement: "$rootElement",
47
51
  $routerGlobals: "$routerGlobals",
48
52
  $sce: "$sce",
49
53
  $sceDelegate: "$sceDelegate",
@@ -54,7 +58,7 @@ export const $injectTokens = Object.freeze({
54
58
  $templateRequest: "$templateRequest",
55
59
  $transitions: "$transitions",
56
60
  $urlConfig: "$urlConfig",
57
- $urlService: "$urlService",
61
+ $url: "$url",
58
62
  $view: "$view",
59
63
  // provide literals
60
64
  $provide: "$provide",
package/src/interface.ts CHANGED
@@ -4,6 +4,8 @@ export * from "./core/di/ng-module.js";
4
4
  export * from "./services/http/interface.ts";
5
5
  export * from "./services/log/interface.ts";
6
6
  export * from "./services/log/log.js";
7
+ export * from "./services/location/interface.ts";
8
+ export * from "./services/location/location.js";
7
9
  export * from "./services/pubsub/pubsub.js";
8
10
  export * from "./services/template-cache/interface.ts";
9
11
  export * from "./services/template-cache/template-cache.js";
@@ -66,7 +68,7 @@ export interface Provider {
66
68
  /**
67
69
  * Register a directive
68
70
  * @param name - The name of the directive.
69
- * @param provider - An object with a `$get` property that defines how the service is created.
71
+ * @param directive - An object with a `$get` property that defines how the service is created.
70
72
  */
71
73
  directive(name: string, directive: DirectiveFactory): Provider;
72
74
 
package/src/loader.md CHANGED
@@ -1,155 +0,0 @@
1
- /\*\*
2
-
3
- - @ngdoc module
4
- - @name ng
5
-
6
- - @installation
7
- - @description
8
- -
9
- - The ng module is loaded by default when an AngularTS application is started. The module itself
10
- - contains the essential components for an AngularTS application to function. The table below
11
- - lists a high level breakdown of each of the services/factories, filters, directives and testing
12
- - components available within this core module.
13
- - \*/
14
-
15
- /\*\*
16
-
17
- - @ngdoc directive
18
- - @name ngApp
19
- -
20
- - @element ANY
21
- - @param {import('./interface.ts').Module} ngApp an optional application
22
- - {@link angular.module module} name to load.
23
- - @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be
24
- - created in "strict-di" mode. This means that the application will fail to invoke functions which
25
- - do not use explicit function annotation (and are thus unsuitable for minification), as described
26
- - in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in
27
- - tracking down the root of these bugs.
28
- -
29
- - @description
30
- -
31
- - Use this directive to **auto-bootstrap** an AngularTS application. The `ngApp` directive
32
- - designates the **root element** of the application and is typically placed near the root element
33
- - of the page - e.g. on the `<body>` or `<html>` tags.
34
- -
35
- - There are a few things to keep in mind when using `ngApp`:
36
- - - only one AngularTS application can be auto-bootstrapped per HTML document. The first `ngApp`
37
- - found in the document will be used to define the root element to auto-bootstrap as an
38
- - application. To run multiple applications in an HTML document you must manually bootstrap them using
39
- - {@link angular.bootstrap} instead.
40
- - - AngularTS applications cannot be nested within each other.
41
- - - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`.
42
- - This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and
43
- - {@link ngRoute.ngView `ngView`}.
44
- - Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},
45
- - causing animations to stop working and making the injector inaccessible from outside the app.
46
- -
47
- - You can specify an **AngularTS module** to be used as the root module for the application. This
48
- - module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It
49
- - should contain the application code needed or have dependencies on other modules that will
50
- - contain the code. See {@link angular.module} for more information.
51
- -
52
- - In the example below if the `ngApp` directive were not placed on the `html` element then the
53
- - document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
54
- - would not be resolved to `3`.
55
- -
56
- - @example
57
- -
58
- - ### Simple Usage
59
- -
60
- - `ngApp` is the easiest, and most common way to bootstrap an application.
61
- - <example module="ngAppDemo" name="ng-app">
62
- <file name="index.html">
63
- <div ng-controller="ngAppDemoController">
64
- I can add: {{a}} + {{b}} = {{ a+b }}
65
- </div>
66
- </file>
67
- <file name="script.js">
68
- angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
69
- $scope.a = 1;
70
- $scope.b = 2;
71
- });
72
- </file>
73
- </example>
74
- -
75
- - @example
76
- -
77
- - ### With `ngStrictDi`
78
- -
79
- - Using `ngStrictDi`, you would see something like this:
80
- - <example ng-app-included="true" name="strict-di">
81
- <file name="index.html">
82
- <div ng-app="ngAppStrictDemo" ng-strict-di>
83
- <div ng-controller="GoodController1">
84
- I can add: {{a}} + {{b}} = {{ a+b }}
85
-
86
- <p>This renders because the controller does not fail to
87
- instantiate, by using explicit annotation style (see
88
- script.js for details)
89
- </p>
90
- </div>
91
-
92
- <div ng-controller="GoodController2">
93
- Name: <input ng-model="name"><br />
94
- Hello, {{name}}!
95
-
96
- <p>This renders because the controller does not fail to
97
- instantiate, by using explicit annotation style
98
- (see script.js for details)
99
- </p>
100
- </div>
101
-
102
- <div ng-controller="BadController">
103
- I can add: {{a}} + {{b}} = {{ a+b }}
104
-
105
- <p>The controller could not be instantiated, due to relying
106
- on automatic function annotations (which are disabled in
107
- strict mode). As such, the content of this section is not
108
- interpolated, and there should be an error in your web console.
109
- </p>
110
- </div>
111
-
112
- </div>
113
- </file>
114
- <file name="script.js">
115
- angular.module('ngAppStrictDemo', [])
116
- // BadController will fail to instantiate, due to relying on automatic function annotation,
117
- // rather than an explicit annotation
118
- .controller('BadController', function($scope) {
119
- $scope.a = 1;
120
- $scope.b = 2;
121
- })
122
- // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,
123
- // due to using explicit annotations using the array style and $inject property, respectively.
124
- .controller('GoodController1', ['$scope', function($scope) {
125
- $scope.a = 1;
126
- $scope.b = 2;
127
- }])
128
- .controller('GoodController2', GoodController2);
129
- function GoodController2($scope) {
130
- $scope.name = 'World';
131
- }
132
- GoodController2.$inject = ['$scope'];
133
- </file>
134
- <file name="style.css">
135
- div[ng-controller] {
136
- margin-bottom: 1em;
137
- -webkit-border-radius: 4px;
138
- border-radius: 4px;
139
- border: 1px solid;
140
- padding: .5em;
141
- }
142
- div[ng-controller^=Good] {
143
- border-color: #d6e9c6;
144
- background-color: #dff0d8;
145
- color: #3c763d;
146
- }
147
- div[ng-controller^=Bad] {
148
- border-color: #ebccd1;
149
- background-color: #f2dede;
150
- color: #a94442;
151
- margin-bottom: 0;
152
- }
153
- </file>
154
- </example>
155
- */
@@ -132,10 +132,11 @@ import {
132
132
  ngPostDirective,
133
133
  ngPutDirective,
134
134
  } from "./directive/http/http.js";
135
+ import { $injectTokens as $t } from "./injection-tokens.js";
135
136
 
136
137
  /**
137
138
  * Initializes core `ng` module.
138
- * @param {import('./loader.js').Angular} angular
139
+ * @param {import('./angular.js').Angular} angular
139
140
  * @returns {import('./core/di/ng-module.js').NgModule} `ng` module
140
141
  */
141
142
  export function registerNgModule(angular) {
@@ -144,7 +145,7 @@ export function registerNgModule(angular) {
144
145
  "ng",
145
146
  [],
146
147
  [
147
- "$provide",
148
+ $t.$provide,
148
149
  /** @param {import("./interface.js").Provider} $provide */
149
150
  ($provide) => {
150
151
  // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
@@ -152,7 +153,7 @@ export function registerNgModule(angular) {
152
153
  $$sanitizeUri: SanitizeUriProvider,
153
154
  });
154
155
  $provide
155
- .provider("$compile", CompileProvider)
156
+ .provider($t.$compile, CompileProvider)
156
157
  .directive({
157
158
  input: inputDirective,
158
159
  textarea: inputDirective,
@@ -269,7 +270,7 @@ export function registerNgModule(angular) {
269
270
  $state: StateProvider,
270
271
  $ngViewScroll: ViewScrollProvider,
271
272
  $templateFactory: TemplateFactoryProvider,
272
- $urlService: UrlService,
273
+ $url: UrlService,
273
274
  $stateRegistry: StateRegistryProvider,
274
275
  $eventBus: PubSubProvider,
275
276
  });
@@ -277,14 +278,12 @@ export function registerNgModule(angular) {
277
278
  ],
278
279
  )
279
280
  .factory("$stateParams", [
280
- "$routerGlobals",
281
+ $t.$routerGlobals,
281
282
  /**
282
283
  * @param {import('./router/globals.js').RouterGlobals} globals
283
284
  * @returns {import('./router/params/state-params.js').StateParams }
284
285
  */
285
- function (globals) {
286
- return globals.params;
287
- },
286
+ (globals) => globals.params,
288
287
  ])
289
288
  .value("$trace", trace);
290
289
  }
@@ -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
 
4
4
  describe("public", () => {
5
5
  beforeEach(() => {
@@ -1,4 +1,4 @@
1
- import { Angular } from "../../loader.js";
1
+ import { Angular } from "../../angular.js";
2
2
  import { createElementFromHTML, dealoc } from "../../shared/dom.js";
3
3
  import { browserTrigger, wait } from "../../shared/test-utils.js";
4
4
 
@@ -15,7 +15,7 @@ describe("ngStateRef", () => {
15
15
  $injector,
16
16
  $state,
17
17
  $stateParams,
18
- $urlService;
18
+ $url;
19
19
 
20
20
  beforeEach(() => {
21
21
  dealoc(document.getElementById("app"));
@@ -30,7 +30,8 @@ describe("ngStateRef", () => {
30
30
  */
31
31
  ($stateProvider, $locationProvider) => {
32
32
  _locationProvider = $locationProvider;
33
- $locationProvider.setHashPrefix("");
33
+ $locationProvider.html5ModeConf.enabled = false;
34
+ $locationProvider.hashPrefixConf = "";
34
35
  $stateProvider
35
36
  .state({ name: "top", url: "" })
36
37
  .state({ name: "other", url: "/other/:id", template: "other" })
@@ -60,9 +61,9 @@ describe("ngStateRef", () => {
60
61
  $rootScope = $injector.get("$rootScope");
61
62
  $compile = $injector.get("$compile");
62
63
  $state = $injector.get("$state");
63
- $stateParams = $injector.get("$stateParams");
64
- $urlService = $injector.get("$urlService");
65
- $urlService.listen();
64
+ $stateParams = $injector.get("$routerGlobals").params;
65
+ $url = $injector.get("$url");
66
+ $url.listen();
66
67
  });
67
68
 
68
69
  afterEach(() => (window.location.hash = ""));
@@ -704,7 +705,7 @@ describe("ngSrefActive", () => {
704
705
  $rootScope = $injector.get("$rootScope");
705
706
  $compile = $injector.get("$compile");
706
707
  $state = $injector.get("$state");
707
- $stateParams = $injector.get("$stateParams");
708
+ $stateParams = $injector.get("$routerGlobals").params;
708
709
  });
709
710
 
710
711
  it("should update class for sibling ngSref", async () => {
@@ -1,10 +1,5 @@
1
1
  import { filter, tail, unnestR } from "../../shared/common.js";
2
- import {
3
- hasAnimate,
4
- isDefined,
5
- isFunction,
6
- // isString,
7
- } from "../../shared/utils.js";
2
+ import { hasAnimate, isDefined, isFunction } from "../../shared/utils.js";
8
3
  // import { kebobString } from "../../shared/strings.js";
9
4
  import { parse } from "../../shared/hof.js";
10
5
  import { ResolveContext } from "../resolve/resolve-context.js";
@@ -283,7 +278,7 @@ export let ngView = [
283
278
  * @param {string} viewName Name of the view.
284
279
  */
285
280
  newScope.$emit("$viewContentLoading", name);
286
- const cloned = $transclude(newScope, function (clone) {
281
+ currentEl = $transclude(newScope, function (clone) {
287
282
  setCacheData(clone, "$ngViewAnim", $ngViewAnim);
288
283
  setCacheData(clone, "$ngView", $ngViewData);
289
284
  renderer.enter(clone, $element, function () {
@@ -299,7 +294,6 @@ export let ngView = [
299
294
  });
300
295
  cleanupLastView();
301
296
  });
302
- currentEl = cloned;
303
297
  currentScope = newScope;
304
298
  /**
305
299
  * Fired once the view is **loaded**, *after* the DOM is rendered.
@@ -1,5 +1,5 @@
1
1
  import { createElementFromHTML, dealoc } from "../../shared/dom.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("ngView", () => {
@@ -852,7 +852,7 @@ describe("ngView named", () => {
852
852
 
853
853
  // Test for https://github.com/angular-ui/ui-router/issues/3355
854
854
  xit("should target weird nested view setups using the view's simple name", async () => {
855
- const tpl = `
855
+ elem.innerHTML = `
856
856
  <div>
857
857
  <div ng-view="main">
858
858
  MAIN-DEFAULT-
@@ -862,7 +862,6 @@ describe("ngView named", () => {
862
862
  </div>
863
863
  </div>
864
864
  `;
865
- elem.innerHTML = tpl;
866
865
  $compile(elem)($rootScope);
867
866
 
868
867
  $state.go("test");
@@ -1833,9 +1832,9 @@ describe("angular 1.5+ style .component()", () => {
1833
1832
  name: "ng12-dynamic-directive",
1834
1833
  url: "/ng12dynamicDirective/:type",
1835
1834
  componentProvider: [
1836
- "$stateParams",
1837
- function ($stateParams) {
1838
- return $stateParams.type;
1835
+ "$routerGlobals",
1836
+ function ($routerGlobals) {
1837
+ return $routerGlobals.params.type;
1839
1838
  },
1840
1839
  ],
1841
1840
  });
@@ -1861,9 +1860,9 @@ describe("angular 1.5+ style .component()", () => {
1861
1860
  name: "dynamicComponent",
1862
1861
  url: "/dynamicComponent/:type",
1863
1862
  componentProvider: [
1864
- "$stateParams",
1865
- function ($stateParams) {
1866
- return $stateParams.type;
1863
+ "$routerGlobals",
1864
+ function ($routerGlobals) {
1865
+ return $routerGlobals.params.type;
1867
1866
  },
1868
1867
  ],
1869
1868
  });
@@ -6,13 +6,12 @@
6
6
 
7
7
  <link rel="shortcut icon" type="image/png" href="/images/favicon.ico" />
8
8
  <link rel="stylesheet" href="/jasmine/jasmine.css" />
9
- <link rel="stylesheet" href="/public/jasmine-helper.css" />
9
+ <link rel="stylesheet" href="/jasmine-helper.css" />
10
10
  <script src="/jasmine/jasmine.js"></script>
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/router/common/glob.spec.js"></script>
15
- <script type="module" src="/src/router/common/queue.spec.js"></script>
14
+ <script type="module" src="/src/router/glob/glob.spec.js"></script>
16
15
  </head>
17
16
  <body>
18
17
  <div id="app"></div>
@@ -1,10 +1,11 @@
1
1
  import { test, expect } from "@playwright/test";
2
2
 
3
- const TEST_URL = "src/router/common/common.html";
3
+ const TEST_URL = "src/router/glob/glob.html";
4
4
 
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
  );
@@ -1,5 +1,5 @@
1
1
  import { StateParams } from "./params/state-params.js";
2
- import { Queue } from "./common/queue.js";
2
+ import { Queue } from "../shared/queue.js";
3
3
 
4
4
  /** @typedef {import('../interface.ts').ServiceProvider} ServiceProvider } */
5
5
 
@@ -89,8 +89,13 @@ export class PathUtils {
89
89
  // The param keys specified by the incoming toParams
90
90
  return toPath.map(makeInheritedParamsNode);
91
91
  }
92
+
92
93
  /**
93
94
  * Computes the tree changes (entering, exiting) between a fromPath and toPath.
95
+ * @param {PathNode[]} fromPath
96
+ * @param {PathNode[]} toPath
97
+ * @param {boolean} [reloadState]
98
+ * @returns {import("../transition/interface.js").TreeChanges}
94
99
  */
95
100
  static treeChanges(fromPath, toPath, reloadState) {
96
101
  const max = Math.min(fromPath.length, toPath.length);
@@ -0,0 +1,45 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>AngularTS</title>
6
+ <link rel="shortcut icon" type="image/png" href="images/favicon.ico" />
7
+ <script type="module" src="../index.js"></script>
8
+ <script>
9
+ document.addEventListener("DOMContentLoaded", () => {
10
+ window.angular.module("router", []).config([
11
+ "$stateProvider",
12
+ "$locationProvider",
13
+ ($stateProvider, $locationProvider) => {
14
+ $locationProvider.html5ModeConf = {
15
+ enabled: false,
16
+ };
17
+ $stateProvider
18
+ .state({
19
+ name: "home",
20
+ url: "",
21
+ template: `
22
+ <h1>Home</h1>
23
+ <a ng-sref="page1">Page 1</a>
24
+ <a ng-sref="page2">Page 2</a>
25
+ `,
26
+ })
27
+ .state({
28
+ name: "page1",
29
+ url: "/page1",
30
+ template: "<h3>Its the NG-Router hello world app!</h3>",
31
+ })
32
+ .state({
33
+ name: "page2",
34
+ url: "/page2",
35
+ template: "This is another template",
36
+ });
37
+ },
38
+ ]);
39
+ });
40
+ </script>
41
+ </head>
42
+ <body ng-app="router">
43
+ <ng-view></ng-view>
44
+ </body>
45
+ </html>
@@ -1,4 +1,4 @@
1
- import { Angular } from "../loader.js";
1
+ import { Angular } from "../angular.js";
2
2
  import { dealoc } from "../shared/dom.js";
3
3
 
4
4
  describe("router services", () => {
@@ -11,14 +11,14 @@ describe("router services", () => {
11
11
  let module = window["angular"].module("defaultModule", []);
12
12
  module.config(
13
13
  (
14
- $urlServiceProvider,
14
+ $urlProvider,
15
15
  $stateRegistryProvider,
16
16
  $routerGlobalsProvider,
17
17
  $transitionsProvider,
18
18
  $stateProvider,
19
19
  ) => {
20
20
  providers = {
21
- $urlServiceProvider,
21
+ $urlProvider,
22
22
  $stateRegistryProvider,
23
23
  $routerGlobalsProvider,
24
24
  $transitionsProvider,
@@ -33,7 +33,7 @@ describe("router services", () => {
33
33
  });
34
34
 
35
35
  it("Should expose ng-router providers from the UIRouter instance", () => {
36
- expect(providers.$urlServiceProvider).toBeDefined();
36
+ expect(providers.$urlProvider).toBeDefined();
37
37
  expect(providers.$stateRegistryProvider).toBeDefined();
38
38
  expect(providers.$stateRegistryProvider).toBeDefined();
39
39
  expect(providers.$transitionsProvider).toBeDefined();
@@ -41,12 +41,11 @@ describe("router services", () => {
41
41
  });
42
42
 
43
43
  it("Should expose ng-router services from the UIRouter instance", () => {
44
- expect($injector.get("$urlService")).toBeDefined();
44
+ expect($injector.get("$url")).toBeDefined();
45
45
  expect($injector.get("$stateRegistry")).toBeDefined();
46
46
  expect($injector.get("$routerGlobals")).toBeDefined();
47
47
  expect($injector.get("$transitions")).toBeDefined();
48
48
  expect($injector.get("$state")).toBeDefined();
49
- expect($injector.get("$stateParams")).toBeDefined();
50
49
  expect($injector.get("$view")).toBeDefined();
51
50
  expect($injector.get("$trace")).toBeDefined();
52
51
  });
@@ -607,7 +607,7 @@ export interface StateDeclaration {
607
607
  *
608
608
  * An optional object which defines multiple views, or explicitly targets specific named ui-views.
609
609
  *
610
- * - What is a view config
610
+ * - What is a view urlConfig
611
611
  * - What is a ui-view
612
612
  * - Shorthand controller/template
613
613
  * - Incompatible with ^
@@ -30,7 +30,7 @@ function dataBuilder(state) {
30
30
  return state.data;
31
31
  }
32
32
 
33
- function getUrlBuilder($urlService, root) {
33
+ function getUrlBuilder($url, root) {
34
34
  return function (stateObject) {
35
35
  let stateDec = stateObject.self;
36
36
  // For future states, i.e., states whose name ends with `.**`,
@@ -50,9 +50,9 @@ function getUrlBuilder($urlService, root) {
50
50
  const parsed = parseUrl(stateDec.url);
51
51
  const url = !parsed
52
52
  ? stateDec.url
53
- : $urlService.compile(parsed.val, { state: stateDec });
53
+ : $url.compile(parsed.val, { state: stateDec });
54
54
  if (!url) return null;
55
- if (!$urlService.isMatcher(url))
55
+ if (!$url.isMatcher(url))
56
56
  throw new Error(`Invalid url '${url}' in state '${stateObject}'`);
57
57
  return parsed && parsed.root
58
58
  ? url
@@ -1,5 +1,5 @@
1
1
  import { StateBuilder } from "./state-builder.js";
2
- import { Angular } from "../../loader.js";
2
+ import { Angular } from "../../angular.js";
3
3
  import { dealoc } from "../../shared/dom.js";
4
4
 
5
5
  // TODO refactor this to url service as it is using the provider right now
@@ -1,6 +1,6 @@
1
1
  import { defaults, find } from "../../shared/common.js";
2
2
  import { propEq } from "../../shared/hof.js";
3
- import { Glob } from "../common/glob.js";
3
+ import { Glob } from "../glob/glob.js";
4
4
  import { hasOwn, isFunction, isObject } from "../../shared/utils.js";
5
5
 
6
6
  /** @typedef {import('./interface.js').StateDeclaration} StateDeclaration */
@@ -16,8 +16,8 @@ import { $injectTokens, provider } from "../../injection-tokens.js";
16
16
  *
17
17
  */
18
18
  export class StateRegistryProvider {
19
- static $inject = provider([
20
- $injectTokens.$urlService,
19
+ /* @ignore */ static $inject = provider([
20
+ $injectTokens.$url,
21
21
  $injectTokens.$state,
22
22
  $injectTokens.$routerGlobals,
23
23
  $injectTokens.$view,