小编has*_*san的帖子

无法在 app.module 中导入 MatDialogModule

我是角度的初学者,我正在使用角度材质对话框。首先,我将材料添加到我的项目中并从@angular/material.

当我在中添加 ( import { MatDialogModule } from '@angular/material/dialog';)) 时app.module.ts,在编译项目时出现以下错误

 ERROR in node_modules/@angular/cdk/coercion/array.d.ts(10,60): error
 TS1005: ',' expected.
 node_modules/@angular/cdk/coercion/array.d.ts(10,61): error TS1005:
 ',' expected. node_modules/@angular/cdk/coercion/array.d.ts(10,75):
 error TS1144: '{' or ';' expected.
 node_modules/@angular/cdk/coercion/array.d.ts(10,77): error TS1011: An
 element access expression should take an argument.
Run Code Online (Sandbox Code Playgroud)

为什么?

这是我的 package.json:

      {
      "name": "sales-maret",
      "version": "0.0.0",
      "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
        "test": "ng test",
        "lint": "ng lint",
        "e2e": "ng e2e"
      },
      "private": true,
      "dependencies": {
        "@angular/animations": "^7.2.16",
        "@angular/cdk": …
Run Code Online (Sandbox Code Playgroud)

dialog angular-material angular-cli angular angular9

6
推荐指数
3
解决办法
1万
查看次数