0
我有以下結構:NG自舉+ angular4:動態HTML模式內容加載
.
├── companies.component.ts
├── companies.html
├── companies.service.ts
└── components
└── modal
├── modal.component.html
└── modal.component.ts
我的模態分量是這樣的:
@Component({
selector: 'service-modal',
templateUrl: './modal.component.html'
})
export class ModalComponent implements OnInit {
public modalHeader: string;
public modalContent: string;
constructor(private activeModal: NgbActiveModal) {
}
public ngOnInit() {
}
public closeModal() {
this.activeModal.close();
}
}
我用它從我的companies.component.ts
是這樣的:
const activeModal = this.modalService.open(ModalComponent, { size: 'lg' });
activeModal.componentInstance.modalHeader = 'Create company';
activeModal.componentInstance.modalContent = 'company form';
我想使用模式組件來創建公司OR用戶實體。將html表單綁定到modalContent是否是一個好習慣?還有其他的方式嗎?我應該創建兩個不同的模式組件(一個用於用戶,一個用於公司)?