Create a separate NgModule that imports all of the Angular Material components

Posted at: April 5, 2019 2:22 PM

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.

You can watch video on Create a separate NgModule that imports all of the Angular Material components


angular material import all modules angular material 2 demo angular material tutorial angular material components example angular material io components create ngmodule angular material tutorial angular ngmodel

Please leave comments

1 Comments

truecodex launched free android app. You can download and install truecodex app on your mobile and get notification of the latest post.

Video Tutorials on YouTube