@@ -8,42 +8,46 @@ import { UrlService } from '@uirouter/core';
8
8
9
9
const app = angular . module ( 'minimal' , [ 'ui.router.upgrade' ] ) ;
10
10
11
- app . run ( ( $stateRegistry , $urlService ) => {
12
- $urlService . rules . initial ( { state : 'app' } ) ;
11
+ app . run ( [
12
+ '$stateRegistry' ,
13
+ '$urlService' ,
14
+ ( $stateRegistry , $urlService ) => {
15
+ $urlService . rules . initial ( { state : 'app' } ) ;
13
16
14
- $stateRegistry . register ( {
15
- url : '' ,
16
- name : 'app' ,
17
- template : `
17
+ $stateRegistry . register ( {
18
+ url : '' ,
19
+ name : 'app' ,
20
+ template : `
18
21
<a ui-sref=".ng1" ui-sref-active-eq="active">app.ng1</a>
19
22
<a ui-sref=".ng1.ng2" ui-sref-active-eq="active">app.ng1.ng2</a>
20
23
<a ui-sref=".ng2" ui-sref-active-eq="active">app.ng2</a>
21
24
<a ui-sref=".ng2.ng2" ui-sref-active-eq="active">app.ng2.ng2</a>
22
25
<ui-view></ui-view>
23
26
` ,
24
- } ) ;
27
+ } ) ;
25
28
26
- // route to ng1 component
27
- $stateRegistry . register ( {
28
- url : '/ng1' ,
29
- name : 'app.ng1' ,
30
- component : 'ng1Component' ,
31
- } ) ;
29
+ // route to ng1 component
30
+ $stateRegistry . register ( {
31
+ url : '/ng1' ,
32
+ name : 'app.ng1' ,
33
+ component : 'ng1Component' ,
34
+ } ) ;
32
35
33
- // nested route to ng2 component
34
- $stateRegistry . register ( {
35
- url : '/ng2' ,
36
- name : 'app.ng1.ng2' ,
37
- component : Ng2Component ,
38
- } ) ;
36
+ // nested route to ng2 component
37
+ $stateRegistry . register ( {
38
+ url : '/ng2' ,
39
+ name : 'app.ng1.ng2' ,
40
+ component : Ng2Component ,
41
+ } ) ;
39
42
40
- // route to ng2 component
41
- $stateRegistry . register ( {
42
- url : '/ng2' ,
43
- name : 'app.ng2' ,
44
- component : Ng2Component ,
45
- } ) ;
46
- } ) ;
43
+ // route to ng2 component
44
+ $stateRegistry . register ( {
45
+ url : '/ng2' ,
46
+ name : 'app.ng2' ,
47
+ component : Ng2Component ,
48
+ } ) ;
49
+ } ,
50
+ ] ) ;
47
51
48
52
// An AngularJS component
49
53
app . component ( 'ng1Component' , {
@@ -52,8 +56,8 @@ app.component('ng1Component', {
52
56
<a ui-sref="app">Back to app</a>
53
57
<ui-view></ui-view>
54
58
` ,
55
- controller : function ( ) {
56
- this . $onInit = function ( ) {
59
+ controller : function ( ) {
60
+ this . $onInit = function ( ) {
57
61
console . log ( 'ng1Component.$onInit()' ) ;
58
62
} ;
59
63
} ,
@@ -63,10 +67,10 @@ app.component('ng1Component', {
63
67
@Component ( {
64
68
selector : 'ng2-component' ,
65
69
template : `
66
- <h1>ng2 component</h1>
67
- <a uiSref="app">Back to app</a>
68
- <ui-view></ui-view>
69
- ` ,
70
+ <h1>ng2 component</h1>
71
+ <a uiSref="app">Back to app</a>
72
+ <ui-view></ui-view>
73
+ ` ,
70
74
} )
71
75
export class Ng2Component {
72
76
ngOnInit ( ) {
@@ -102,12 +106,12 @@ export class RootModule {
102
106
103
107
// Using AngularJS config block, call `deferIntercept()`.
104
108
// This tells UI-Router to delay the initial URL sync (until all bootstrapping is complete)
105
- app . config ( [ '$urlServiceProvider' , $urlService => $urlService . deferIntercept ( ) ] ) ;
109
+ app . config ( [ '$urlServiceProvider' , ( $urlService ) => $urlService . deferIntercept ( ) ] ) ;
106
110
107
111
// Manually bootstrap the Angular app
108
112
platformBrowserDynamic ( )
109
113
. bootstrapModule ( RootModule )
110
- . then ( platformRef => {
114
+ . then ( ( platformRef ) => {
111
115
// get() UrlService from DI (this call will create all the UIRouter services)
112
116
const url : UrlService = platformRef . injector . get ( UrlService ) ;
113
117
0 commit comments