jhipster 和主细节

jhipster and master detail

我已经使用 Jhipster .jdl 文件创建了所有 classes。 现在我有 2 个 class 具有主从关系,因此我在表单顶部看到了主记录(例如 A),以及一个 list/table 的详细记录(例如 B)。 注意连 class B 也是由 jhipster 生成的!

现在,在我的 list/table B 表示中,我需要放置删除按钮,因此我 link 将其添加到从原始 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.

我该怎么做?

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