|
1 | | -import { APP_BASE_HREF, CommonModule, HashLocationStrategy, Location, LocationStrategy, LOCATION_INITIALIZED, PathLocationStrategy, PlatformLocation } from '@angular/common'; |
2 | | -import { ApplicationRef, APP_BOOTSTRAP_LISTENER, ComponentRef, Inject, Injectable, Injector, ModuleWithProviders, NgModule, NgProbeToken, NO_ERRORS_SCHEMA, Optional, inject, provideAppInitializer } from '@angular/core'; |
3 | | -import { ExtraOptions, NoPreloading, PreloadingStrategy, provideRoutes, Router, RouterModule, RouterPreloader, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, Routes, ɵROUTER_PROVIDERS } from '@angular/router'; |
| 1 | +import { |
| 2 | + APP_BASE_HREF, |
| 3 | + CommonModule, |
| 4 | + HashLocationStrategy, |
| 5 | + Location, |
| 6 | + LocationStrategy, |
| 7 | + LOCATION_INITIALIZED, |
| 8 | + PathLocationStrategy, |
| 9 | + PlatformLocation, |
| 10 | +} from '@angular/common'; |
| 11 | +import { |
| 12 | + ApplicationRef, |
| 13 | + APP_BOOTSTRAP_LISTENER, |
| 14 | + ComponentRef, |
| 15 | + Inject, |
| 16 | + Injectable, |
| 17 | + Injector, |
| 18 | + ModuleWithProviders, |
| 19 | + NgModule, |
| 20 | + NgProbeToken, |
| 21 | + NO_ERRORS_SCHEMA, |
| 22 | + Optional, |
| 23 | + inject, |
| 24 | + provideAppInitializer, |
| 25 | +} from '@angular/core'; |
| 26 | +import { |
| 27 | + ExtraOptions, |
| 28 | + NoPreloading, |
| 29 | + PreloadingStrategy, |
| 30 | + provideRoutes, |
| 31 | + Router, |
| 32 | + RouterModule, |
| 33 | + RouterPreloader, |
| 34 | + ROUTER_CONFIGURATION, |
| 35 | + ROUTER_INITIALIZER, |
| 36 | + Routes, |
| 37 | + ɵROUTER_PROVIDERS, |
| 38 | +} from '@angular/router'; |
4 | 39 | import { of, Subject } from 'rxjs'; |
5 | 40 | import { NativeScriptCommonModule } from '../nativescript-common.module'; |
6 | 41 | import { START_PATH } from '../tokens'; |
@@ -55,7 +90,7 @@ export class RouterInitializer { |
55 | 90 | appInitializer(): Promise<any> { |
56 | 91 | const p: Promise<any> = this.injector.get(LOCATION_INITIALIZED, Promise.resolve(null)); |
57 | 92 | return p.then(() => { |
58 | | - // eslint-disable-next-line @typescript-eslint/ban-types, @typescript-eslint/no-non-null-assertion |
| 93 | + // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type, @typescript-eslint/no-non-null-assertion |
59 | 94 | let resolve: Function = null!; |
60 | 95 | const res = new Promise((r) => (resolve = r)); |
61 | 96 | const router: any = this.injector.get(Router); |
@@ -114,8 +149,14 @@ export function routerNgProbeToken() { |
114 | 149 | return new NgProbeToken('Router', Router); |
115 | 150 | } |
116 | 151 |
|
117 | | -export function provideLocationStrategy(platformLocationStrategy: PlatformLocation, baseHref: string, options: ExtraOptions = {}) { |
118 | | - return options.useHash ? new HashLocationStrategy(platformLocationStrategy, baseHref) : new PathLocationStrategy(platformLocationStrategy, baseHref); |
| 152 | +export function provideLocationStrategy( |
| 153 | + platformLocationStrategy: PlatformLocation, |
| 154 | + baseHref: string, |
| 155 | + options: ExtraOptions = {}, |
| 156 | +) { |
| 157 | + return options.useHash |
| 158 | + ? new HashLocationStrategy(platformLocationStrategy, baseHref) |
| 159 | + : new PathLocationStrategy(platformLocationStrategy, baseHref); |
119 | 160 | } |
120 | 161 |
|
121 | 162 | export function provideLocationInitialized(startpath: string | Promise<string>) { |
|
0 commit comments