Adding Angular Material to Nx Workspace

Viewed 623

I'm getting started with Nx and I'm following the tutorial available on their website https://nx.dev/angular Now I'm trying to add angular material to my project. A simple ng add @angular/material would do the trick, but only for the root app. What I'm trying to achieve is having all of my apps and libraries to use the same Material Theme. So I want my root app to use it as well as my other components under libs, e.g. HeaderComponent. I couldn't find any tutoriol to clarify that till now.

1 Answers

Have you installed your libs and apps with nx?

Once you install Angular Material with npm, you'll need to add manually Angular Material to every app and library module.

Let's say you have a library called "shared-ui", it probably has root module, add Angular Material in to imports, and exports if you'll want it to use across all library.

Related