I have a lazyloading modules setup through angular-routing , i am using angular-material
package for rendering data. As recommended i have made a custom module for materail-components named MaterialModule
(with a forRoot
method) I import it in app-module
as forRoot : MaterialModule.forRoot(),
, however in my lazy-loaded components/modules this MaterialModule
is not available unless i explicitly import it across all the lazy-loaded modules as well.
app-module.ts
imports: [
BrowserModule,
AppRoutingModule,
MaterialModule.forRoot(),
CoreModule]
=============
material-module.ts
export class MaterialModule {
static forRoot(): ModuleWithProviders {
return {
ngModule: MaterialModule
}
}
}
Is there a way a shared-module (like this MaterialModule) can be made available across all the lazy-loaded modules in angular.