MatToolbar throws error when using it with Angular 9
This used to happen to me whenever I imported 'MatToolbar' 'MatDialog' instead of 'MatToolbarModule' or 'MatDialogModule'.
I had the same problem before, its because you modify your app.module.ts
file while the server is running.
Try to stop it and then run it again using the ng serve
command.
Add below specific configuration in package.json
and npm install
.
{
"scripts": {
"postinstall": "ngcc"
}
}
Reference: https://angular.io/guide/ivy#speeding-up-ngcc-compilation