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

Issue

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.

Answered By – MahdiJoon

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published