How to extract p-dialog content in external component

UI Components for Angular
Post Reply
franco.whyline
Posts: 3
Joined: 29 Jun 2021, 20:08

03 Sep 2021, 17:41

Hi guys,
I am doing a refactor on my app and I want to have the p-dialog in a component but the content of (including header and footer) of the p-dialog in another component.

Code: Select all

<p-dialog
      [(visible)]="show"
      [style]="{ width: '500px' }"
      [draggable]="false"
      [modal]="true"
>
      <app-tag-form></app-tag-form>
</p-dialog>
Inside of my app-tag-form I have:

Code: Select all

<ng-template pTemplate="header">
    <h1 translate>PAGES.TAGS.TITLE</h1>
</ng-template>

<form novalidate autocomplete="off" [formGroup]="form" #tagForm="ngForm">
...
</form>

<ng-template pTemplate="footer">
  <button
    pButton
    label="{{ 'PAGES.TAGS.SAVE' | translate }}"
    (click)="save()"
    [disabled]="form.invalid"
    pRipple
  ></button>
</ng-template>
But when I open the p-dialog, I can only see the form, the header and footer is not showing, this is the result:
Image

How can I make it work?
Thanks!

franco.whyline
Posts: 3
Joined: 29 Jun 2021, 20:08

10 Sep 2021, 16:29

Anyone can help with this? I am really blocked whit this issue!

Andrus8
Posts: 1
Joined: 14 Sep 2021, 12:21

14 Sep 2021, 12:22

Use Bootstrap's JavaScript modal plugin to add dialogs to your site for ... and remove scroll from the <body> so that modal content scrolls instead.
L Brands Aces

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests