0
votes

I've added angular material to a component library...well I thought I did!

Everything is working in the test harness (app.module,app.component, etc...)

However when I export my library I get the error

Can't resolve '@angular/material'

So apparently I haven't added Angular Material where it needs to be added.

2
are you trying to use it inside an app when you get that error ? because if that's the case then you just need to install @angular/material inside that app - Gurvinder Guraya
Yes, I've imported my component library into an application and receive the error - Funn_Bobby
yeah so the thing is that @angular-material is a peer dependency of your library module so it doesn't get installed on it's own. Install it inside the app and it should solve your problem - Gurvinder Guraya

2 Answers

0
votes

Try npm install @angular/material --save and it should work.

0
votes

try with ng add @angular/material the guide is available at angular material