Angular 8 and Material Missing

950 Views Asked by At

I am trying to create a template with a paginated table and am using the example from https://material.angular.io/components/table/overview#pagination which has a link to a stackblitz example https://stackblitz.com/angular/bymxnvovkvk

When I download the code, run npm install and then ng serve I see a page that looks simialar, but is missing some Material design and looks very flat. When I try to add other material items like a Sidenav, I get errors stating "can not find module “@angular/material”. I verified that it is included, but why would it not work on my machine if its working on stackblitz?

1

There are 1 best solutions below

1
On BEST ANSWER

I also had a problem with Angular material not working properly. I installed it through npm, but it seems that the better solution is to use,

ng add @angular/material.

This should work fine and make angular material work properly. You also might want to uninstall @angular/material first, using:

npm uninstall @angular/material

Hope it helps!

PS Say no to the HammerJS option when it is installing.

Suggested reading: https://material.angular.io/guide/getting-started