jhipster和主要细节

时间:2020-03-17 10:13:18

标签: angular spring typescript jhipster master-detail

我已经用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.

我该怎么做?

1 个答案:

答案 0 :(得分:0)

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