【问题标题】:jhipster and master detailjhipster 和 master 细节
【发布时间】:2020-03-17 10:13:18
【问题描述】:

我已经使用 Jhipster .jdl 文件创建了我的所有课程。 现在我有 2 个具有主从关系的类,所以我在表单顶部看到主记录(例如 A),以及详细记录的列表/表(例如 B)。 请注意,即使是 B 类也是由 jhipster 生成的!

现在在 B 的列表/表格表示中,我需要放置删除按钮,以便将其链接到从原始 DetailBClass 复制的函数:

...in the html file...
<button type="button" (click)="deleteDetail(detailB)" [pTooltip]="'entity.action.delete' | translate" class="btn btn-danger btn-sm">
       <fa-icon [icon]="'times'"></fa-icon>
</button>
...in the ts file...
deleteDetail(detailBClass: IDetailBClass) {
   const modalRef = this.modalService.open(DetailBClassDeleteDialogComponent, { size: 'lg', backdrop: 'static' });
   modalRef.componentInstance.detailBClass = detailBClass;
}

这样做,当我点击删除行按钮时,会报错:

ERROR Error: Uncaught (in promise): Error: Type DetailBClassDeleteDialogComponent is part of the declarations of 2 modules: MasterAClassModule and DetailBClassModule!
Please consider moving DetailBClassDeleteDialogComponent to a higher module that imports MasterAClassModule and DetailBClassModule. 
You can also create a new NgModule that exports and includes DetailBClassDeleteDialogComponent then import that NgModule in MasterAClassModule and DetailBClassModule.

我该怎么做?

【问题讨论】:

    标签: angular spring typescript jhipster master-detail


    【解决方案1】:

    最简单的解决方案是复制并粘贴模块(不是在页面之间共享)并在详细信息中使用此副本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-13
      • 1970-01-01
      • 1970-01-01
      • 2019-07-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-11-24
      相关资源
      最近更新 更多