sonal.paghdal
sonal.paghdal

Reputation: 266

Angular 7 - how to use p-dialog of prime-ng in easy way

I am using a prime-ng component p-dialog. I created a MyModal component for modal.i want to open this MyModal component on click event like uib-modal. Is any easy way to do like uib-modal?

Upvotes: 3

Views: 864

Answers (1)

Markus Dresch
Markus Dresch

Reputation: 5574

Add your MyModal component tag to the embedding component template and toggle it using *ngIf.

<my-modal *ngIf="show" name="{{ name }}"></my-modal>

<button (click)="show = true">show dialog</button>

Here's a working StackBlitz example: https://stackblitz.com/edit/angular-m9bphb

Upvotes: 1

Related Questions