1
- import { ANALYZE_FOR_ENTRY_COMPONENTS , ModuleWithProviders , NgModule } from '@angular/core' ;
1
+ import { ANALYZE_FOR_ENTRY_COMPONENTS , APP_INITIALIZER , ModuleWithProviders , NgModule , NgZone } from '@angular/core' ;
2
+ import { Location , LocationStrategy , HashLocationStrategy } from '@angular/common' ;
2
3
import { BrowserModule , HAMMER_GESTURE_CONFIG } from '@angular/platform-browser' ;
3
4
import { FormsModule , ReactiveFormsModule } from '@angular/forms' ;
4
5
import { HttpModule } from '@angular/http' ;
5
6
6
-
7
7
/**
8
8
* Import Providers
9
9
*/
10
10
import { ActionSheetController } from './components/action-sheet/action-sheet' ;
11
11
import { AlertController } from './components/alert/alert' ;
12
12
import { App } from './components/app/app' ;
13
- import { provideConfig } from './config/config' ;
14
- import { provideEvents } from './util/events' ;
13
+ import { Config , UserConfig , setupConfig } from './config/config' ;
14
+ import { DeepLinker , setupDeepLinker , UserDeepLinkConfig } from './navigation/deep-linker' ;
15
+ import { setupProvideEvents } from './util/events' ;
15
16
import { FeatureDetect } from './util/feature-detect' ;
16
17
import { Form } from './util/form' ;
17
18
import { GestureController } from './gestures/gesture-controller' ;
@@ -21,26 +22,19 @@ import { LoadingController } from './components/loading/loading';
21
22
import { MenuController } from './components/menu/menu-controller' ;
22
23
import { ModalController } from './components/modal/modal' ;
23
24
import { PickerController } from './components/picker/picker' ;
24
- import { providePlatform , UserAgent , UserNavigatorPlatform , UserDir , UserLang } from './platform/platform' ;
25
+ import { Platform , setupPlatform , UserAgent , UserNavigatorPlatform , UserDir , UserLang } from './platform/platform' ;
25
26
import { PopoverController } from './components/popover/popover' ;
26
- import { provideDeepLinker } from './navigation/deep-linker' ;
27
- import { provideQueryParams , UserUrl } from './platform/query-params' ;
28
- import { TapClick , provideTapClick } from './components/tap-click/tap-click' ;
27
+ import { QueryParams , setupQueryParams , UserUrl } from './platform/query-params' ;
28
+ import { TapClick , setupTapClick } from './components/tap-click/tap-click' ;
29
29
import { ToastController } from './components/toast/toast' ;
30
30
import { Translate } from './translation/translate' ;
31
31
import { TransitionController } from './transitions/transition-controller' ;
32
32
import { UserRoot } from './components/app/app-root' ;
33
-
33
+ import { UrlSerializer } from './navigation/url-serializer' ;
34
34
35
35
/**
36
- * Export Providers
36
+ * Import Overlay Entry Components
37
37
*/
38
- export { DeepLinker , provideDeepLinker } from './navigation/deep-linker' ;
39
- export { NavController } from './navigation/nav-controller' ;
40
- export { NavParams } from './navigation/nav-params' ;
41
- export { NavLink , NavOptions , DeepLink , DeepLinkConfig } from './navigation/nav-util' ;
42
- export { ViewController } from './navigation/view-controller' ;
43
-
44
38
import { ActionSheetCmp } from './components/action-sheet/action-sheet-component' ;
45
39
import { AlertCmp } from './components/alert/alert-component' ;
46
40
import { IONIC_DIRECTIVES } from './directives' ;
@@ -51,6 +45,16 @@ import { PickerCmp } from './components/picker/picker-component';
51
45
import { PopoverCmp } from './components/popover/popover-component' ;
52
46
import { ToastCmp } from './components/toast/toast-component' ;
53
47
48
+ /**
49
+ * Export Providers
50
+ */
51
+ export { DeepLinker , UserDeepLinkConfig } from './navigation/deep-linker' ;
52
+ export { NavController } from './navigation/nav-controller' ;
53
+ export { NavParams } from './navigation/nav-params' ;
54
+ export { NavLink , NavOptions , DeepLink , DeepLinkConfig } from './navigation/nav-util' ;
55
+ export { UrlSerializer } from './navigation/url-serializer' ;
56
+ export { ViewController } from './navigation/view-controller' ;
57
+
54
58
55
59
@NgModule ( {
56
60
imports : [ BrowserModule , HttpModule , FormsModule , ReactiveFormsModule ] ,
@@ -83,20 +87,54 @@ export class IonicModule {
83
87
ngModule : IonicModule ,
84
88
providers : [
85
89
{ provide : ANALYZE_FOR_ENTRY_COMPONENTS , useValue : userAppRoot , multi : true } ,
90
+ { provide : APP_INITIALIZER , useFactory : setupTapClick ,
91
+ deps : [
92
+ Config ,
93
+ App ,
94
+ NgZone
95
+ ] ,
96
+ multi : true
97
+ } ,
98
+ { provide : APP_INITIALIZER , useFactory : setupProvideEvents , deps : [ Platform ] , multi : true } ,
99
+ { provide : Config , useFactory : setupConfig ,
100
+ deps : [
101
+ UserConfig ,
102
+ QueryParams ,
103
+ Platform
104
+ ]
105
+ } ,
106
+ { provide : DeepLinker , useFactory : setupDeepLinker ,
107
+ deps : [
108
+ App ,
109
+ UrlSerializer ,
110
+ Location
111
+ ]
112
+ } ,
86
113
{ provide : HAMMER_GESTURE_CONFIG , useClass : IonicGestureConfig } ,
114
+ { provide : LocationStrategy , useClass : HashLocationStrategy } ,
115
+ { provide : Platform , useFactory : setupPlatform ,
116
+ deps : [
117
+ QueryParams ,
118
+ UserAgent ,
119
+ UserNavigatorPlatform ,
120
+ UserDir ,
121
+ UserLang ,
122
+ NgZone
123
+ ]
124
+ } ,
125
+ { provide : QueryParams , useFactory : setupQueryParams ,
126
+ deps : [
127
+ UserUrl
128
+ ]
129
+ } ,
87
130
{ provide : UserAgent , useFactory : getWindowUserAgent } ,
88
131
{ provide : UserDir , useFactory : getDocumentDir } ,
89
132
{ provide : UserLang , useFactory : getDocumentLang } ,
90
133
{ provide : UserNavigatorPlatform , useFactory : getWindowPlatform } ,
91
134
{ provide : UserRoot , useValue : userAppRoot } ,
92
135
{ provide : UserUrl , useFactory : getWindowLocation } ,
93
-
94
- provideConfig ( userConfig ) ,
95
- provideDeepLinker ( userDeepLinkConfig ) ,
96
- provideEvents ( ) ,
97
- providePlatform ( ) ,
98
- provideQueryParams ( ) ,
99
- provideTapClick ( ) ,
136
+ { provide : UserConfig , useValue : userConfig } ,
137
+ { provide : UserDeepLinkConfig , useValue : userDeepLinkConfig } ,
100
138
101
139
ActionSheetController ,
102
140
AlertController ,
@@ -106,14 +144,16 @@ export class IonicModule {
106
144
GestureController ,
107
145
Keyboard ,
108
146
LoadingController ,
147
+ Location ,
109
148
MenuController ,
110
149
ModalController ,
111
150
PickerController ,
112
151
PopoverController ,
113
152
TapClick ,
114
153
ToastController ,
115
154
Translate ,
116
- TransitionController
155
+ TransitionController ,
156
+ UrlSerializer
117
157
]
118
158
} ;
119
159
}
0 commit comments