Search code examples
javascriptangulartypescriptangular-componentsng-zorro-antd

Hot to call my own component inside modal Angular 12 and NGZorro


I would like to call my own component inside nzmodal. I have tried this:

<nz-modal
  [(nzVisible)]="isVisible"
  nzTitle="Create relation"
  (nzOnCancel)="handleCancel()"
  (nzOnOk)="handleOk()">

  <app-label-relation-create>
  </app-label-relation-create>
</nz-modal>

Inside label relation create I have form.

Have I add some reference in routing module? Or, are there an easier way to do it?


Solution

  • You can use nzContent API, nzTitle API and nzFooter API. They accept templateRef and string as input. using templateRef will solve your problem.