Creating a Shared Angular Material Module

Photo by Annie Spratt on Unsplash



import {
} from '@angular/material';

Then add these to an array:

const mm = [ MatTabsModule, MatSnackBarModule ];

Then expand the array in the imports property ( … operator ) and add it to the exports property and the MaterialModule is ready to go.

imports: [],
exports: mm
export class MaterialModule {}

Now just import it into the other modules that will be using the material components.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store