|
1 | 1 | import { |
2 | 2 | APP_BASE_HREF, |
3 | | - CommonModule, |
4 | 3 | HashLocationStrategy, |
5 | | - Location, |
6 | | - LocationStrategy, |
7 | 4 | LOCATION_INITIALIZED, |
| 5 | + LocationStrategy, |
8 | 6 | PathLocationStrategy, |
9 | 7 | PlatformLocation, |
10 | 8 | } from '@angular/common'; |
11 | 9 | import { |
12 | 10 | ApplicationRef, |
13 | | - APP_BOOTSTRAP_LISTENER, |
14 | 11 | ComponentRef, |
15 | 12 | Inject, |
16 | 13 | Injectable, |
17 | 14 | Injector, |
18 | 15 | ModuleWithProviders, |
19 | 16 | NgModule, |
20 | | - NgProbeToken, |
21 | 17 | NO_ERRORS_SCHEMA, |
22 | 18 | Optional, |
23 | | - inject, |
24 | | - provideAppInitializer, |
25 | 19 | } from '@angular/core'; |
26 | 20 | import { |
27 | 21 | ExtraOptions, |
28 | | - NoPreloading, |
29 | | - PreloadingStrategy, |
30 | 22 | provideRoutes, |
31 | 23 | Router, |
| 24 | + ROUTER_CONFIGURATION, |
32 | 25 | RouterModule, |
33 | 26 | RouterPreloader, |
34 | | - ROUTER_CONFIGURATION, |
35 | | - ROUTER_INITIALIZER, |
36 | 27 | Routes, |
37 | 28 | ɵROUTER_PROVIDERS, |
38 | 29 | } from '@angular/router'; |
@@ -145,10 +136,6 @@ export class RouterInitializer { |
145 | 136 | } |
146 | 137 | } |
147 | 138 |
|
148 | | -export function routerNgProbeToken() { |
149 | | - return new NgProbeToken('Router', Router); |
150 | | -} |
151 | | - |
152 | 139 | export function provideLocationStrategy( |
153 | 140 | platformLocationStrategy: PlatformLocation, |
154 | 141 | baseHref: string, |
@@ -195,65 +182,6 @@ export class NativeScriptRouterModule { |
195 | 182 | { provide: START_PATH, useValue: '' }, |
196 | 183 | ], |
197 | 184 | }; |
198 | | - return { |
199 | | - ngModule: NativeScriptRouterModule, |
200 | | - providers: [ |
201 | | - ...ɵROUTER_PROVIDERS, |
202 | | - provideRoutes(routes), |
203 | | - { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} }, |
204 | | - { |
205 | | - provide: LocationStrategy, |
206 | | - useFactory: provideLocationStrategy, |
207 | | - deps: [PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], ROUTER_CONFIGURATION], |
208 | | - }, |
209 | | - // { |
210 | | - // provide: RouterScroller, |
211 | | - // useFactory: createRouterScroller, |
212 | | - // deps: [Router, ViewportScroller, ROUTER_CONFIGURATION] |
213 | | - // }, |
214 | | - { |
215 | | - provide: PreloadingStrategy, |
216 | | - useExisting: config && config.preloadingStrategy ? config.preloadingStrategy : NoPreloading, |
217 | | - }, |
218 | | - { provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken }, |
219 | | - // { |
220 | | - // provide: NSLocationStrategy, |
221 | | - // useFactory: provideLocationStrategy, |
222 | | - // deps: [[NSLocationStrategy, new Optional(), new SkipSelf()], FrameService], |
223 | | - // }, |
224 | | - // { provide: LocationStrategy, useExisting: NSLocationStrategy }, |
225 | | - NativescriptPlatformLocation, |
226 | | - // { provide: NativescriptPlatformLocation, useClass: NativescriptPlatformLocation, deps: [[START_PATH, new Optional()]]}, |
227 | | - { |
228 | | - provide: PlatformLocation, |
229 | | - useExisting: NativescriptPlatformLocation, |
230 | | - }, |
231 | | - { |
232 | | - provide: LOCATION_INITIALIZED, |
233 | | - useFactory: provideLocationInitialized, |
234 | | - deps: [[START_PATH, new Optional()]], |
235 | | - }, |
236 | | - { provide: START_PATH, useValue: 'home2' }, |
237 | | - RouterInitializer, |
238 | | - provideAppInitializer(() => { |
239 | | - const initializerFn = getAppInitializer(inject(RouterInitializer)); |
240 | | - return initializerFn(); |
241 | | - }), |
242 | | - { |
243 | | - provide: ROUTER_INITIALIZER, |
244 | | - useFactory: getBootstrapListener, |
245 | | - deps: [RouterInitializer], |
246 | | - }, |
247 | | - { |
248 | | - provide: APP_BOOTSTRAP_LISTENER, |
249 | | - multi: true, |
250 | | - useExisting: ROUTER_INITIALIZER, |
251 | | - }, |
252 | | - // RouterExtensions, |
253 | | - // NSRouteReuseStrategy, |
254 | | - // { provide: RouteReuseStrategy, useExisting: NSRouteReuseStrategy }, |
255 | | - ], |
256 | | - }; |
257 | 185 | } |
258 | 186 |
|
259 | 187 | static forModal(routes: Routes, config?: ExtraOptions): ModuleWithProviders<NativeScriptRouterModule> { |
@@ -284,40 +212,6 @@ export class NativeScriptRouterModule { |
284 | 212 | ModalRouterInitializer, |
285 | 213 | ], |
286 | 214 | }; |
287 | | - return { |
288 | | - ngModule: NativeScriptRouterModule, |
289 | | - providers: [ |
290 | | - ...ɵROUTER_PROVIDERS, |
291 | | - provideRoutes(routes), |
292 | | - { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} }, |
293 | | - { |
294 | | - provide: LocationStrategy, |
295 | | - useFactory: provideLocationStrategy, |
296 | | - deps: [PlatformLocation, [new Inject(APP_BASE_HREF), new Optional()], ROUTER_CONFIGURATION], |
297 | | - }, |
298 | | - { |
299 | | - provide: PreloadingStrategy, |
300 | | - useExisting: config && config.preloadingStrategy ? config.preloadingStrategy : NoPreloading, |
301 | | - }, |
302 | | - { provide: NgProbeToken, multi: true, useFactory: routerNgProbeToken }, |
303 | | - // { |
304 | | - // provide: NSLocationStrategy, |
305 | | - // useFactory: provideLocationStrategy, |
306 | | - // deps: [[NSLocationStrategy, new Optional(), new SkipSelf()], FrameService], |
307 | | - // }, |
308 | | - // { provide: LocationStrategy, useExisting: NSLocationStrategy }, |
309 | | - NativescriptPlatformLocation, |
310 | | - { |
311 | | - provide: PlatformLocation, |
312 | | - useExisting: NativescriptPlatformLocation, |
313 | | - }, |
314 | | - { provide: START_PATH, useValue: 'home3' }, |
315 | | - // { provide: Location, useClass: Location}, |
316 | | - // RouterExtensions, |
317 | | - // NSRouteReuseStrategy, |
318 | | - // { provide: RouteReuseStrategy, useExisting: NSRouteReuseStrategy }, |
319 | | - ], |
320 | | - }; |
321 | 215 | } |
322 | 216 |
|
323 | 217 | static forChild(routes: Routes): ModuleWithProviders<NativeScriptRouterModule> { |
|
0 commit comments