In angular 7, trying to use angular material mat-dialog-content. While importing in app.module.ts
it gives the following error:
TypeError
"@angular/animations": "^7.2.15",
"@angular/cdk": "^8.0.1",
"@angular/common": "~7.2.0",
"@angular/compiler": "~7.2.0",
"@angular/core": "~7.2.0",
"@angular/forms": "~7.2.0",
"@angular/material": "^8.0.1",
"@angular/platform-browser": "~7.2.0",
"@angular/platform-browser-dynamic": "~7.2.0",
You use @angular/cdk
and @angular/material
in version 8 together with @angular/core @angular/common
7. If you want to stay at Angular 7 uninstall cdk and material and install the specific cdk and material for version 7.
npm uninstall @angular/cdk @angular/material
... find out the version 7
npm show @angular/cdk versions
npm show @angular/material versions
... and then install the specific one
npm install @angular/cdk@7.2.15
Or just upgrade your angular
npm install -g @angular/cli@latest
ng update @angular/cli @angular-devkit/build-angular
ng update @angular/core @angular/cdk @angular/material
After one of this two options try it again.
Change the dependencies to the lowest version of @angular/core or @angular/cdk. It's normally due to a mismatch
"dependencies": {
"@angular/core": "^7.2.0",
"@angular/cdk": "^7.2.0",
"@angular/material": "^7.2.0"
},