@@ -65,6 +65,8 @@ import {services} from "../common/coreservices";
6565import { ProviderLike } from "../state/interface" ;
6666import { Resolvable } from "../resolve/resolvable" ;
6767import { ngModuleResolvablesBuilder } from "./statebuilders/lazyLoadNgModuleResolvable" ;
68+ import { flattenR } from "../common/common" ;
69+ import { UIROUTER_STATES_TOKEN } from "./uiRouterNgModule" ;
6870
6971export const NG1_UIROUTER_TOKEN = new OpaqueToken ( "$uiRouter" ) ;
7072
@@ -110,18 +112,22 @@ let uiRouterFactory = (injector: Injector) => {
110112
111113 // Prep the tree of NgModule by placing the root NgModule's Injector on the root state.
112114 let ng2InjectorResolvable = Resolvable . fromData ( NG2_INJECTOR_TOKEN , injector ) ;
113- router . stateRegistry . root ( ) . resolvables . push ( ng2InjectorResolvable ) ;
115+ registry . root ( ) . resolvables . push ( ng2InjectorResolvable ) ;
114116
115117
116118 // ----------------- Initialize router -------------
117119 // Allow states to be registered
118- router . stateRegistry . stateQueue . autoFlush ( router . stateService ) ;
120+ registry . stateQueue . autoFlush ( router . stateService ) ;
119121
120122 setTimeout ( ( ) => {
121123 // Let the app apply custom configuration...
122124 // (global transition hooks, deferIntercept, otherwise, etc)
123125 routerConfig . configure ( router ) ;
124126
127+ // Register the states from the root NgModule [[UIRouterModule]]
128+ let states = ( injector . get ( UIROUTER_STATES_TOKEN ) || [ ] ) . reduce ( flattenR , [ ] ) ;
129+ states . forEach ( state => registry . register ( state ) ) ;
130+
125131 // Start monitoring the URL
126132 if ( ! router . urlRouterProvider . interceptDeferred ) {
127133 router . urlRouter . listen ( ) ;
0 commit comments