I have utilized Jhipster's .jdl file to create all of my classes. Currently, I have two classes with a master-detail relationship. This setup displays the master record (let's say A) at the top of my form and a list/table of detail records (for example B). It's worth noting that even class B was generated by jhipster!
Within the list/table representation of B, I need to include a delete button that links to a function taken from the original 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;
}
Upon clicking the delete-row button, an error is triggered:
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.
How do I resolve this issue?