fix(router): init is not triggered in certain scenarios
This commit is contained in:
parent
2fef30f619
commit
2d4be1c9eb
|
@ -61,9 +61,13 @@ export function provideRouter(config: RouterConfig): any[] {
|
|||
// APP_INITIALIZER -> Router)
|
||||
setTimeout(_ => {
|
||||
const appRef = injector.get(ApplicationRef);
|
||||
appRef.registerBootstrapListener((_) => {
|
||||
if (appRef.componentTypes.length == 0) {
|
||||
appRef.registerBootstrapListener((_) => {
|
||||
injector.get(Router).initialNavigation()
|
||||
});
|
||||
} else {
|
||||
injector.get(Router).initialNavigation()
|
||||
});
|
||||
}
|
||||
}, 0);
|
||||
return _ => null;
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue