TypeError: Object(…) is not a function for angular-material

我是研究僧i 提交于 2019-12-01 22:16:47
    "@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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!