I'm having troubles using Angular material with Angular 6 whenever I want to use features modules. Here is my project's structure :
app/
|- app.component.ts
|- app.component.html
|- app.module.ts
|- app-routing.module.ts
|- homepage/
|- homepage.module.ts
|- homepage-routing.module.ts
|- pages/
|- homepage.component.html
|- homepage.component.ts
|- homepage.component.css
|- inbox/
|- inbox.module.ts
|- inbox-routing.module.ts
|- pages/
|- inbox.component.html
|- inbox.component.ts
|- inbox.component.css
Both inbox and homepage are lazy loaded.
I'm trying to use Angular Material in both homepage.component.html and inbox.component.html (I want to use MatButtonModule) but failing to do so and the official documentation doesn't help me.
Here is what I tried :
- If I try to import MatButtonModule into both
homepage.module.tsandinbox.module.ts, the app will crash with this errorUncaught (in promise): TypeError: Cannot read property 'call' of undefined. - If I try to import MatButtonModule into only one module, it will work only for the component binding to this module.
- If I try to import MatButtonModule directly into
app.module.tsit just won't work at all.
So my question is, how can I use Angular Material with features modules, what is the best practices?