Create a separate NgModule that imports all of the Angular Material components
In this lesson we will learn, how to create a separate NgModule that imports all of the Angular Material components. You can import this module wherever you would like to use the Angular Material components.
Must be sure this NgModule import after BrowserModule
.
Create a NgModule
Now a created MaterialDesignModule
. You can import all of the Angular Material components in this module.
src/app/material-design/material-design.module.ts
Import NgModule MaterialDesignModule
Import this NgModule MaterialDesignModule
wherever you would like to use the Angular Material components. For example import in AppModule
src/app/app-module.ts
Use in HTML
src/app/app.component.html
Conclusion
I have learnt in this lesson to creating a separate NgModule MaterialDesignModule
and imports MatCheckboxModule, MatButtonModule
of the Angular Material components for creating checkbox and button.