Skip to content

Commit b26f0dd

Browse files
committed
[Lazyload] Supply the loaded states with the lazy loaded Injector.
1 parent 3c043dd commit b26f0dd

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/lazyLoad/lazyLoadNgModule.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,13 @@ export function applyNgModule(transition: Transition, ng2Module: NgModuleRef<any
161161

162162
// Supply the newly loaded states with the Injector from the lazy loaded NgModule
163163
replacementState.$$state().resolvables.push(Resolvable.fromData(NATIVE_INJECTOR_TOKEN, injector));
164+
newChildModules.forEach(module => {
165+
(module.states || []).forEach(state => {
166+
if (state.name && state.name.indexOf(replacementName) !== 0) {
167+
registry.get(state.name).$$state().resolvables.push(Resolvable.fromData(NATIVE_INJECTOR_TOKEN, injector));
168+
}
169+
});
170+
});
164171

165172
return {};
166173
}

src/uiRouterNgModule.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export class UIRouterModule {
110110
locationStrategy(config.useHash),
111111
...makeRootProviders(config),
112112
]
113-
}
113+
};
114114
}
115115

116116
/**
@@ -141,7 +141,7 @@ export class UIRouterModule {
141141
return {
142142
ngModule: UIRouterModule,
143143
providers: makeChildProviders(module),
144-
}
144+
};
145145
}
146146

147147
}
@@ -161,12 +161,12 @@ export interface RootModule extends StatesModule {
161161
*
162162
* Defaults to `false`
163163
*/
164-
useHash?: boolean
164+
useHash?: boolean;
165165

166166
/**
167167
* Sets [[UrlRouterProvider.otherwise]].
168168
*/
169-
otherwise?: (string | UrlRuleHandlerFn | TargetState | TargetStateDef)
169+
otherwise?: (string | UrlRuleHandlerFn | TargetState | TargetStateDef);
170170

171171
/**
172172
* Sets [[UrlRouterProvider.deferIntercept]]

0 commit comments

Comments
 (0)