Skip to content

Commit a151f71

Browse files
fix(ng2.UIRouterConfig): Allow new UIRouter() to finish before configuring it
Execute `.config()` in a setTimeout() to allow the UIRouter constructor to fully complete.
1 parent 4f53f81 commit a151f71

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/ng2/providers.ts

+8-6
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,14 @@ let uiRouterFactory = (routerConfig: UIRouterConfig, location: UIRouterLocation,
7474

7575
router.stateRegistry.stateQueue.autoFlush(router.stateService);
7676

77-
routerConfig.configure(router);
78-
79-
if (!router.urlRouterProvider.interceptDeferred) {
80-
router.urlRouter.listen();
81-
router.urlRouter.sync();
82-
}
77+
setTimeout(() => {
78+
routerConfig.configure(router);
79+
80+
if (!router.urlRouterProvider.interceptDeferred) {
81+
router.urlRouter.listen();
82+
router.urlRouter.sync();
83+
}
84+
});
8385

8486
return router;
8587
};

0 commit comments

Comments
 (0)