首页 > 解决方案 > 角度材质对话框导入问题

问题描述

早上好,

我想显示角度材料的对话框,但我对导入有问题,我不明白这个问题。

当然,我有一个角材料模块,我在其中导入了 matdialog,然后在 app.module 中导入了它

错误:错误错误:未捕获(承诺):错误:类型DialogFormComponent是2个模块声明的一部分:AppModule和ProduitsModule!

应用程序模块

import { DialogFormComponent } from './produits/dialog-form/dialog-form.component';

@NgModule({
  declarations: [
    AppComponent,
    DialogFormComponent
  ],
  entryComponents: [DialogFormComponent],

产品.ts

export class ProduitsComponent implements OnInit {

  public productArray: Produit[] = [];

  constructor(public dialog: MatDialog) { }

  ngOnInit() {
  }

  openDialog() {
    this.dialog.open(DialogFormComponent);
  }

}

标签: angulartypescriptangular-material

解决方案


我找到了解决方案,实际上我有一个 produits.module,其中声明了 dialogFormComponent 我现在删除了它,感谢您的帮助,一切正常


推荐阅读