@angular-wave/angular.ts 0.0.31 → 0.0.33

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 (46) hide show
  1. package/dist/angular-ts.esm.js +1 -1
  2. package/dist/angular-ts.umd.js +1 -1
  3. package/index.html +5 -14
  4. package/package.json +1 -1
  5. package/src/core/compile.js +5 -4
  6. package/src/core/location.js +1 -1
  7. package/src/core/parser/parse.js +1 -2
  8. package/src/core/root-scope.js +49 -99
  9. package/src/directive/events.js +2 -1
  10. package/src/directive/model.js +4 -2
  11. package/src/router/directives/state-directives.js +33 -18
  12. package/src/router/directives/view-directive.js +1 -2
  13. package/src/router/globals.js +2 -0
  14. package/src/router/index.js +23 -21
  15. package/src/router/services.js +6 -62
  16. package/src/router/state/state-queue-manager.js +2 -1
  17. package/src/router/state/state-registry.js +35 -18
  18. package/src/router/state/state-service.js +169 -1
  19. package/src/router/state/views.js +46 -2
  20. package/src/router/transition/reject-factory.js +0 -8
  21. package/src/router/transition/transition-service.js +43 -1
  22. package/src/router/url/url-config.js +7 -1
  23. package/src/router/url/url-rule.js +4 -4
  24. package/src/router/url/url-service.js +32 -15
  25. package/src/router/view/view.js +7 -51
  26. package/src/services/http.js +1 -1
  27. package/src/shared/strings.js +7 -2
  28. package/test/core/compile.spec.js +2 -2
  29. package/test/core/scope.spec.js +2 -37
  30. package/test/router/services.spec.js +7 -15
  31. package/test/router/state-directives.spec.js +2 -2
  32. package/test/router/state-filter.spec.js +0 -2
  33. package/test/router/state.spec.js +4 -4
  34. package/test/router/template-factory.spec.js +19 -10
  35. package/test/router/url-service.spec.js +4 -6
  36. package/test/router/view-directive.spec.js +9 -9
  37. package/test/router/view-hook.spec.js +10 -10
  38. package/legacy/angular-animate.js +0 -4272
  39. package/legacy/angular-aria.js +0 -426
  40. package/legacy/angular-message-format.js +0 -1072
  41. package/legacy/angular-messages.js +0 -829
  42. package/legacy/angular-route.js +0 -1266
  43. package/legacy/angular-sanitize.js +0 -891
  44. package/legacy/angular.js +0 -36600
  45. package/src/router/router.js +0 -103
  46. package/test/original-test.html +0 -33
package/index.html CHANGED
@@ -26,13 +26,13 @@
26
26
  <script type="module" src="test/directive/click.spec.js"></script>
27
27
  <script type="module" src="test/directive/cloak.spec.js"></script>
28
28
  <script type="module" src="test/directive/controller.spec.js"></script>
29
- <!-- <script type="module" src="test/directive/event.spec.js"></script>
29
+ <script type="module" src="test/directive/event.spec.js"></script>
30
30
  <script type="module" src="test/directive/href.spec.js"></script>
31
31
  <script type="module" src="test/directive/if.spec.js"></script>
32
32
  <script type="module" src="test/directive/include.spec.js"></script>
33
33
  <script type="module" src="test/directive/init.spec.js"></script>
34
34
 
35
- <script type="module" src="test/directive/list.spec.js"></script>
35
+ <!-- <script type="module" src="test/directive/list.spec.js"></script>
36
36
  <script type="module" src="test/directive/model-options.spec.js"></script>
37
37
  <script type="module" src="test/directive/model.spec.js"></script>
38
38
  <script type="module" src="test/directive/non-bindable.spec.js"></script>
@@ -69,7 +69,7 @@
69
69
  <script type="module" src="test/core/location.spec.js"></script>
70
70
  <script type="module" src="test/core/on.spec.js"></script>
71
71
  <script type="module" src="test/core/prop.spec.js"></script>
72
- <script type="module" src="test/core/parse.spec.js"></script>
72
+
73
73
  <script type="module" src="test/core/q.spec.js"></script>
74
74
  <script type="module" src="test/core/root-element.spec.js"></script>
75
75
 
@@ -97,17 +97,8 @@
97
97
  <script type="module" src="test/shared/strings.spec.js"></script>
98
98
  <script type="module" src="test/shared/utils.spec.js"></script>-->
99
99
  <!-- <script type="module" src="test/core/pubsub.spec.js"></script>-->
100
- <script type="module" src="test/router/glob.spec.js"></script>
101
- <script type="module" src="test/router/services.spec.js"></script>
102
- <script type="module" src="test/router/state-directives.spec.js"></script>
103
- <script type="module" src="test/router/state-filter.spec.js"></script>
104
- <script type="module" src="test/router/state.spec.js"></script>
105
- <script type="module" src="test/router/template-factory.spec.js"></script>
106
- <script type="module" src="test/router/url-matcher-factory.spec.js"></script>
107
- <script type="module" src="test/router/view-directive.spec.js"></script>
108
- <script type="module" src="test/router/view-hook.spec.js"></script>
109
- <script type="module" src="test/router/view-scroll.spec.js"></script>
110
- <script type="module" src="test/router/view.spec.js"></script>
100
+ <script type="module" src="test/core/scope.spec.js"></script>
101
+ <script type="module" src="test/core/parse.spec.js"></script>
111
102
 
112
103
 
113
104
  <!-- <script type="module" src="test/core/interval.spec.js"></script>
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@angular-wave/angular.ts",
3
3
  "license": "MIT",
4
- "version": "0.0.31",
4
+ "version": "0.0.33",
5
5
  "type": "module",
6
6
  "main": "dist/angular-ts.esm.js",
7
7
  "browser": "dist/angular-ts.umd.js",
@@ -1,5 +1,6 @@
1
1
  import { jqLite, getBooleanAttrName, isTextNode, startingTag } from "../jqLite";
2
2
  import { identifierForController } from "./controller";
3
+ import { TTL } from "./root-scope";
3
4
  import {
4
5
  minErr,
5
6
  assertArg,
@@ -44,7 +45,6 @@ const $compileMinErr = minErr("$compile");
44
45
 
45
46
  const _UNINITIALIZED_VALUE = new Object();
46
47
  const EXCLUDED_DIRECTIVES = ["ngIf", "ngRepeat"];
47
- let TTL = 10;
48
48
 
49
49
  /**
50
50
  * @ngdoc provider
@@ -659,14 +659,15 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
659
659
 
660
660
  // This function is called in a $$postDigest to trigger all the onChanges hooks in a single digest
661
661
  function flushOnChangesQueue() {
662
+ let ttl = TTL;
662
663
  try {
663
- if (!--TTL) {
664
+ if (!--ttl) {
664
665
  // We have hit the TTL limit so reset everything
665
666
  onChangesQueue = undefined;
666
667
  throw $compileMinErr(
667
668
  "infchng",
668
669
  "{0} $onChanges() iterations reached. Aborting!\n",
669
- TTL,
670
+ ttl,
670
671
  );
671
672
  }
672
673
  // We must run this hook in an apply since the $$postDigest runs outside apply
@@ -682,7 +683,7 @@ export function $CompileProvider($provide, $$sanitizeUriProvider) {
682
683
  onChangesQueue = undefined;
683
684
  });
684
685
  } finally {
685
- TTL++;
686
+ ttl++;
686
687
  }
687
688
  }
688
689
 
@@ -1013,7 +1013,7 @@ export function $LocationProvider() {
1013
1013
  afterLocationChange(oldUrl, oldState);
1014
1014
  }
1015
1015
  });
1016
- if (!$rootScope.$$phase) $rootScope.$digest();
1016
+ if ($rootScope.$$phase !== ScopePhase.NONE) $rootScope.$digest();
1017
1017
  });
1018
1018
 
1019
1019
  // update browser
@@ -6,7 +6,6 @@ import {
6
6
  isFunction,
7
7
  minErr,
8
8
  isString,
9
- lowercase,
10
9
  isNumber,
11
10
  } from "../../shared/utils";
12
11
 
@@ -191,7 +190,7 @@ Lexer.prototype = {
191
190
  let number = "";
192
191
  const start = this.index;
193
192
  while (this.index < this.text.length) {
194
- const ch = lowercase(this.text.charAt(this.index));
193
+ const ch = this.text.charAt(this.index).toLowerCase();
195
194
  if (ch === "." || this.isNumber(ch)) {
196
195
  number += ch;
197
196
  } else {
@@ -13,39 +13,25 @@ import {
13
13
  } from "../shared/utils";
14
14
 
15
15
  /**
16
- * @typedef {"$apply" | "$digest"} ScopePhase
16
+ * @enum {number}
17
17
  */
18
+ export const ScopePhase = {
19
+ NONE: 0,
20
+ APPLY: 1,
21
+ DIGEST: 2,
22
+ };
18
23
 
19
24
  /**
20
- * @ngdoc provider
21
- * @name $rootScopeProvider
22
- * @description
23
- *
24
- * Provider for the $rootScope service.
25
- */
26
-
27
- /**
28
- * @ngdoc method
29
- * @name $rootScopeProvider#digestTtl
30
- * @description
31
- *
32
- * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and
33
- * assuming that the model is unstable.
34
- *
35
- * The current default is 10 iterations.
36
25
  *
37
- * In complex applications it's possible that the dependencies between `$watch`s will result in
38
- * several digest iterations. However if an application needs more than the default 10 digest
39
- * iterations for its model to stabilize then you should investigate what is causing the model to
40
- * continuously change during the digest.
26
+ * The default number of `$digest` iterations the scope should attempt to execute before giving up and
27
+ * assuming that the model is unstable. In complex applications it's possible that the dependencies between `$watch`s will result in
28
+ * several digest iterations.
41
29
  *
42
- * Increasing the TTL could have performance implications, so you should not change it without
43
- * proper justification.
30
+ * @typedef {number} TTL The number of digest iterations
44
31
  *
45
- * @param {number} limit The number of digest iterations.
32
+ * @type {TTL}
46
33
  */
47
-
48
- let TTL = 10;
34
+ export const TTL = 10;
49
35
 
50
36
  const $rootScopeMinErr = minErr("$rootScope");
51
37
  const $$asyncQueue = [];
@@ -54,78 +40,51 @@ const $$applyAsyncQueue = [];
54
40
  let postDigestQueuePosition = 0;
55
41
  let lastDirtyWatch = null;
56
42
  let applyAsyncId = null;
43
+
44
+ /** Services required by each scope instance */
45
+ /** @type {angular.IParseService} */
57
46
  let $parse;
47
+ /** @type {import('../services/browser').Browser} */
58
48
  let $browser;
49
+ /** @type {angular.IExceptionHandlerService} */
59
50
  let $exceptionHandler;
60
51
 
61
52
  /**
62
- * @ngdoc service
63
- * @name $rootScope
64
- *
65
- * @description
66
- *
53
+ * @type {Scope}
54
+ */
55
+ let rootScope;
56
+
57
+ /**
58
+ * Provider responsible for instantiating the initial scope, aka - root scope.
67
59
  * Every application has a single root {@link ng.$rootScope.Scope scope}.
68
60
  * All other scopes are descendant scopes of the root scope. Scopes provide separation
69
61
  * between the model and the view, via a mechanism for watching the model for changes.
70
62
  * They also provide event emission/broadcast and subscription facility. See the
71
63
  * {@link guide/scope developer guide on scopes}.
64
+ *
65
+ * The provider also injects runtime services to make them available to all scopes.
66
+ *
72
67
  */
73
- export function $RootScopeProvider() {
74
- this.digestTtl = function (value) {
75
- if (arguments.length) {
76
- TTL = value;
77
- }
78
- return TTL;
79
- };
68
+ export class $RootScopeProvider {
69
+ constructor() {
70
+ rootScope = new Scope();
71
+ }
80
72
 
81
- this.$get = [
73
+ $get = [
82
74
  "$exceptionHandler",
83
75
  "$parse",
84
76
  "$browser",
77
+ /**
78
+ * @param {angular.IParseService} parse
79
+ * @param {import('../services/browser').Browser} browser
80
+ * @param {angular.IExceptionHandlerService} exceptionHandler
81
+ * @returns {Scope} root scope
82
+ */
85
83
  function (exceptionHandler, parse, browser) {
86
84
  $exceptionHandler = exceptionHandler;
87
85
  $parse = parse;
88
86
  $browser = browser;
89
- /**
90
- * @ngdoc type
91
- * @name $rootScope.Scope
92
- *
93
- * @description
94
- * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
95
- * {@link auto.$injector $injector}. Child scopes are created using the
96
- * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
97
- * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for
98
- * an in-depth introduction and usage examples.
99
- *
100
- *
101
- * ## Inheritance
102
- * A scope can inherit from a parent scope, as in this example:
103
- * ```js
104
- let parent = $rootScope;
105
- let child = parent.$new();
106
-
107
- parent.salutation = "Hello";
108
- expect(child.salutation).toEqual('Hello');
109
-
110
- child.salutation = "Welcome";
111
- expect(child.salutation).toEqual('Welcome');
112
- expect(parent.salutation).toEqual('Hello');
113
- * ```
114
- *
115
- *
116
- *
117
- * @param {Object.<string, function()>=} providers Map of service factory which need to be
118
- * provided for the current scope. Defaults to {@link ng}.
119
- * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should
120
- * append/override services provided by `providers`. This is handy
121
- * when unit-testing and having the need to override a default
122
- * service.
123
- * @returns {Object} Newly created scope.
124
- *
125
- */
126
-
127
- const $rootScope = new Scope();
128
- return $rootScope;
87
+ return rootScope;
129
88
  },
130
89
  ];
131
90
  }
@@ -163,17 +122,6 @@ export function getQueues() {
163
122
  };
164
123
  }
165
124
 
166
- /**
167
- * @param { * } parse
168
- * @param {import('../services/browser').Browser} browser
169
- * @param {Function} exceptionHandler
170
- */
171
- export function initialize(parse, browser, exceptionHandler) {
172
- $parse = parse;
173
- $browser = browser;
174
- $exceptionHandler = exceptionHandler;
175
- }
176
-
177
125
  /**
178
126
  * @type {angular.IScope}
179
127
  */
@@ -183,15 +131,17 @@ class Scope {
183
131
  * @type {number} Unique scope ID (monotonically increasing) useful for debugging.
184
132
  */
185
133
  this.$id = nextUid();
186
- this.$$phase = null;
134
+
135
+ /** @type {ScopePhase} */
136
+ this.$$phase = ScopePhase.NONE;
187
137
 
188
138
  /**
189
- * @type {?Scope} Reference to the parent scope.
139
+ * @type {?angular.IScope} Reference to the parent scope.
190
140
  */
191
141
  this.$parent = null;
192
142
 
193
143
  /**
194
- * @type {Scope}
144
+ * @type {?angular.IScope}
195
145
  */
196
146
  this.$root = this;
197
147
 
@@ -773,7 +723,7 @@ class Scope {
773
723
  let logIdx;
774
724
  let asyncTask;
775
725
 
776
- this.beginPhase("$digest");
726
+ this.beginPhase(ScopePhase.DIGEST);
777
727
  // Check for changes to browser url that happened in sync before the call to $digest
778
728
  // TODO Implement browser
779
729
  $browser.$$checkUrlChange();
@@ -912,10 +862,10 @@ class Scope {
912
862
  * @param {ScopePhase} phase
913
863
  */
914
864
  beginPhase(phase) {
915
- if (this.$root.$$phase) {
865
+ if (this.$root.$$phase !== ScopePhase.NONE) {
916
866
  throw $rootScopeMinErr(
917
867
  "inprog",
918
- "{0} already in progress",
868
+ "digest already in progress",
919
869
  this.$root.$$phase,
920
870
  );
921
871
  }
@@ -1168,7 +1118,7 @@ class Scope {
1168
1118
  // if we are outside of an $digest loop and this is the first time we are scheduling async
1169
1119
  // task also schedule async auto-flush
1170
1120
  let id;
1171
- if (!this.$root.$$phase && !$$asyncQueue.length) {
1121
+ if (this.$root.$$phase === ScopePhase.NONE && !$$asyncQueue.length) {
1172
1122
  id = $browser.defer(
1173
1123
  () => {
1174
1124
  if ($$asyncQueue.length) {
@@ -1239,7 +1189,7 @@ class Scope {
1239
1189
  */
1240
1190
  $apply(expr) {
1241
1191
  try {
1242
- this.beginPhase("$apply");
1192
+ this.beginPhase(ScopePhase.APPLY);
1243
1193
  try {
1244
1194
  return this.$eval(expr);
1245
1195
  } finally {
@@ -1259,7 +1209,7 @@ class Scope {
1259
1209
  }
1260
1210
 
1261
1211
  clearPhase() {
1262
- this.$root.$$phase = null;
1212
+ this.$root.$$phase = ScopePhase.NONE;
1263
1213
  }
1264
1214
 
1265
1215
  /**
@@ -1,4 +1,5 @@
1
1
  import { directiveNormalize } from "../shared/utils";
2
+ import { ScopePhase } from "../core/root-scope";
2
3
 
3
4
  /*
4
5
  * A collection of directives that allows creation of custom event handlers that are defined as
@@ -57,7 +58,7 @@ export function createEventDirective(
57
58
  fn(scope, { $event: event });
58
59
  };
59
60
 
60
- if (!$rootScope.$$phase) {
61
+ if ($rootScope.$$phase === ScopePhase.NONE) {
61
62
  scope.$apply(callback);
62
63
  } else if (forceAsync) {
63
64
  scope.$evalAsync(callback);
@@ -19,6 +19,8 @@ import {
19
19
  import { addSetValidityMethod, nullFormCtrl, setupValidity } from "./form";
20
20
  import { defaultModelOptions } from "./model-options";
21
21
  import { startingTag } from "../jqLite";
22
+ import { ScopePhase } from "../core/root-scope";
23
+
22
24
  export const ngModelMinErr = minErr("ngModel");
23
25
 
24
26
  /**
@@ -839,7 +841,7 @@ NgModelController.prototype = {
839
841
  this.$$pendingDebounce = this.$$timeout(() => {
840
842
  that.$commitViewValue();
841
843
  }, debounceDelay);
842
- } else if (this.$$rootScope.$$phase) {
844
+ } else if (this.$$rootScope.$$phase !== ScopePhase.NONE) {
843
845
  this.$commitViewValue();
844
846
  } else {
845
847
  this.$$scope.$apply(() => {
@@ -1343,7 +1345,7 @@ export const ngModelDirective = [
1343
1345
  element.on("blur", () => {
1344
1346
  if (modelCtrl.$touched) return;
1345
1347
 
1346
- if ($rootScope.$$phase) {
1348
+ if ($rootScope.$$phase !== ScopePhase.NONE) {
1347
1349
  scope.$evalAsync(setTouched);
1348
1350
  } else {
1349
1351
  scope.$apply(setTouched);
@@ -251,10 +251,17 @@ function bindEvents(element, scope, hookFn, ngStateOpts) {
251
251
  * If you need to dynamically update the state being linked to, use the fully dynamic [[ngState]] directive.
252
252
  */
253
253
  export let ngSrefDirective = [
254
- "$router",
254
+ "$state",
255
255
  "$timeout",
256
- function $StateRefDirective($router, $timeout) {
257
- const $state = $router.stateService;
256
+ "$stateRegistry",
257
+ "$transitions",
258
+ function $StateRefDirective(
259
+ $stateService,
260
+ $timeout,
261
+ $stateRegistry,
262
+ $transitions,
263
+ ) {
264
+ const $state = $stateService;
258
265
  return {
259
266
  restrict: "A",
260
267
  require: ["?^ngSrefActive", "?^ngSrefActiveEq"],
@@ -291,8 +298,8 @@ export let ngSrefDirective = [
291
298
  rawDef.ngStateParams = Object.assign({}, scope.$eval(ref.paramExpr));
292
299
  }
293
300
  update();
294
- scope.$on("$destroy", $router.stateRegistry.onStatesChanged(update));
295
- scope.$on("$destroy", $router.transitionService.onSuccess({}, update));
301
+ scope.$on("$destroy", $stateRegistry.onStatesChanged(update));
302
+ scope.$on("$destroy", $transitions.onSuccess({}, update));
296
303
  if (!type.clickable) return;
297
304
  const hookFn = clickHook(element, $state, $timeout, type, getDef);
298
305
  bindEvents(element, scope, hookFn, rawDef.ngStateOpts);
@@ -385,10 +392,16 @@ export let ngSrefDirective = [
385
392
  * ```
386
393
  */
387
394
  export let ngStateDirective = [
388
- "$router",
395
+ "$state",
389
396
  "$timeout",
390
- function $StateRefDynamicDirective($router, $timeout) {
391
- const $state = $router.stateService;
397
+ "$stateRegistry",
398
+ "$transitions",
399
+ function $StateRefDynamicDirective(
400
+ $state,
401
+ $timeout,
402
+ $stateRegistry,
403
+ $transitions,
404
+ ) {
392
405
  return {
393
406
  restrict: "A",
394
407
  require: ["?^ngSrefActive", "?^ngSrefActiveEq"],
@@ -429,8 +442,8 @@ export let ngStateDirective = [
429
442
  });
430
443
  });
431
444
  update();
432
- scope.$on("$destroy", $router.stateRegistry.onStatesChanged(update));
433
- scope.$on("$destroy", $router.transitionService.onSuccess({}, update));
445
+ scope.$on("$destroy", $stateRegistry.onStatesChanged(update));
446
+ scope.$on("$destroy", $transitions.onSuccess({}, update));
434
447
  if (!type.clickable) return;
435
448
  hookFn = clickHook(element, $state, $timeout, type, getDef);
436
449
  bindEvents(element, scope, hookFn, rawDef.ngStateOpts);
@@ -532,14 +545,16 @@ export let ngStateDirective = [
532
545
  */
533
546
  export let ngSrefActiveDirective = [
534
547
  "$state",
535
- "$stateParams",
548
+ "$routerGlobals",
536
549
  "$interpolate",
537
- "$router",
550
+ "$stateRegistry",
551
+ "$transitions",
538
552
  function $StateRefActiveDirective(
539
553
  $state,
540
- $stateParams,
554
+ $routerGlobals,
541
555
  $interpolate,
542
- $router,
556
+ $stateRegistry,
557
+ $transitions,
543
558
  ) {
544
559
  return {
545
560
  restrict: "A",
@@ -583,13 +598,13 @@ export let ngSrefActiveDirective = [
583
598
  trans.promise.then(update, () => {});
584
599
  }
585
600
  $scope.$on("$destroy", setupEventListeners());
586
- if ($router.globals.transition) {
587
- updateAfterTransition($router.globals.transition);
601
+ if ($routerGlobals.transition) {
602
+ updateAfterTransition($routerGlobals.transition);
588
603
  }
589
604
  function setupEventListeners() {
590
605
  const deregisterStatesChangedListener =
591
- $router.stateRegistry.onStatesChanged(handleStatesChanged);
592
- const deregisterOnStartListener = $router.transitionService.onStart(
606
+ $stateRegistry.onStatesChanged(handleStatesChanged);
607
+ const deregisterOnStartListener = $transitions.onStart(
593
608
  {},
594
609
  updateAfterTransition,
595
610
  );
@@ -1,13 +1,12 @@
1
1
  import { filter, tail, unnestR } from "../../shared/common";
2
2
  import { isDefined, isFunction, isString } from "../../shared/utils";
3
3
  import { kebobString } from "../../shared/strings";
4
-
5
4
  import { parse } from "../../shared/hof";
6
5
  import { ResolveContext } from "../resolve/resolve-context";
7
6
  import { trace } from "../common/trace";
8
- import { getLocals } from "../services";
9
7
  import { Ng1ViewConfig } from "../state/views";
10
8
  import { jqLite } from "../../jqLite";
9
+ import { getLocals } from "../state/state-registry";
11
10
  /**
12
11
  * `ui-view`: A viewport directive which is filled in by a view from the active state.
13
12
  *
@@ -31,4 +31,6 @@ export class UIRouterGlobals {
31
31
  */
32
32
  this.successfulTransitions = new Queue([], 1);
33
33
  }
34
+
35
+ $get = [() => this];
34
36
  }
@@ -1,11 +1,4 @@
1
- import {
2
- $routerProvider,
3
- getProviderFor,
4
- getStateProvider,
5
- router,
6
- runBlock,
7
- watchDigests,
8
- } from "./services";
1
+ import { runBlock, watchDigests } from "./services";
9
2
  import { TemplateFactory } from "./template-factory";
10
3
  import { trace } from "./common/trace";
11
4
  import { $ViewScrollProvider } from "./view-scroll";
@@ -16,27 +9,36 @@ import {
16
9
  ngSrefDirective,
17
10
  } from "./directives/state-directives";
18
11
  import { ngView, $ViewDirectiveFill } from "./directives/view-directive";
12
+ import { UrlConfigProvider } from "./url/url-config";
13
+ import { StateRegistry } from "./state/state-registry";
14
+ import { ViewService } from "./view/view";
15
+ import { UrlService } from "./url/url-service";
16
+ import { StateService } from "./state/state-service";
17
+ import { UIRouterGlobals } from "./globals";
18
+ import { TransitionService } from "./transition/transition-service";
19
19
 
20
20
  export function initRouter() {
21
21
  window.angular
22
22
  .module("ng.router", ["ng"])
23
- .provider("$router", $routerProvider)
24
- .provider("$urlService", getProviderFor("urlService"))
25
- .provider("$templateFactory", TemplateFactory)
26
- .provider("$stateRegistry", getProviderFor("stateRegistry"))
27
- .provider("$routerGlobals", getProviderFor("globals"))
28
- .provider("$transitions", getProviderFor("transitionService"))
29
- .provider("$state", ["$routerProvider", getStateProvider])
23
+ .provider("$urlConfig", UrlConfigProvider)
24
+ .provider("$routerGlobals", UIRouterGlobals)
25
+ .provider("$view", ViewService)
26
+ /** @type {TransitionService} A service that exposes global Transition Hooks */
27
+ .provider("$transitions", TransitionService)
28
+ /** @type {StateService} Provides services related to states */
29
+ .provider("$state", StateService)
30
30
  .provider("$ngViewScroll", $ViewScrollProvider)
31
+ .provider("$templateFactory", TemplateFactory)
32
+ .provider("$urlService", UrlService)
33
+ /** Provides a registry for states, and related registration services */
34
+ .provider("$stateRegistry", StateRegistry)
31
35
  .factory("$stateParams", [
32
- "$router",
33
- function ($router) {
34
- return $router.globals.params;
36
+ "$routerGlobals",
37
+ function (globals) {
38
+ return globals.params;
35
39
  },
36
40
  ])
37
- .factory("$view", function () {
38
- return router.viewService;
39
- })
41
+
40
42
  .value("$trace", trace)
41
43
  .filter("isState", $IsStateFilter)
42
44
  .filter("includedByState", $IncludedByStateFilter)