I am trying to retrieve a data present in the url in my APP_INITIALIZER
app.module.ts
export function init(config: ConfigService, router: Router) {
r
config-service.ts can be rewritten as below.
@Injectable()
export class ConfigService
constructor(private injector: Injector){}
load(): Promise {
const router = this.injector.get(Router);
console.log('current url : ' + router.url);
return new Promise(((resolve, reject) => resolve()));
}
}
No need to inject Router as a dependency in app.module.ts.