fix(router): init is not triggered in certain scenarios

This commit is contained in:
vsavkin 2016-06-08 22:45:05 -07:00
parent 2fef30f619
commit 2d4be1c9eb
1 changed files with 6 additions and 2 deletions

View File

@ -61,9 +61,13 @@ export function provideRouter(config: RouterConfig): any[] {
// APP_INITIALIZER -> Router)
setTimeout(_ => {
const appRef = injector.get(ApplicationRef);
if (appRef.componentTypes.length == 0) {
appRef.registerBootstrapListener((_) => {
injector.get(Router).initialNavigation()
});
} else {
injector.get(Router).initialNavigation()
}
}, 0);
return _ => null;
},