We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Single Dialog Box Use in Multiple Pages

Hi

By creating an single popup (same layout) in a page ,Shall we use that same popup in Multiple pages is it possible ? Could you please advise on this.How to Use Single Dialog popup(same layout) in Multiple Pages. 
By binding data  Dynamically on the pages,the same data should show on the popup screen.


Thanks in Advance.

Regards,

Sunithra.C

6 Replies

PO Prince Oliver Syncfusion Team July 1, 2019 12:08 PM UTC

Hello Sunithra, 

Thank you for contacting us. 

Yes. It is possible to show the same Dialog popup in multiple component pages. This can be done by using Dialog component as an Angular service component. The service is a stateless object that contains public functions and maintains the data throughout the life of an application. These functions can be invoked from any Angular component like Controllers, Directives, and more. Please find the below sample. 


In above sample,  
  • We have created Dialog component as a separate service using @Injectable().
  • In this service, we have created common functions like showDialog, hideDialog etc.
  • We have shown/hidden the Dialog component with dynamically updated content using showDialog/hideDialog service method when the buttons are clicked.

Let us know if you need any further assistance on this. 

Regards, 
Prince 



SU sunithra July 2, 2019 06:49 AM UTC

i want  two dropdown list in a form instead of 'Home Dialog Content'.
 that two dropdownlist in popup is common for all pages so is it possible to use that 2 dropdownlist in dialog.ts and bind the  selected dropdown value to home.component.ts 


PO Prince Oliver Syncfusion Team July 4, 2019 07:23 AM UTC

Hi Sunithra 

Thank you for your update. 
  
In a previous update, we provided Dialog component as an Angular service. But, you can achieve your requirement in a much easier way by using parent child interaction in Angular platform. You can render the Dialog as an Angular child component concept and use this child component page to multiple component pages using @Input and @Output decorator. @Input is used to pass data from parent to child and the @Output can be used when you want to pass data from the child to the parent
  
  
In above sample, 
  • We have rendered the Common Dialog on a child Component page with the dropdown list component and assigned the value dynamically to other component pages.
  • We have created ‘Parent’ and ‘Hello’ component page and used in Dialog component.
  • We have shown the Dialog component when you click the button and shown the selected dropdown value in the corresponding component page.
  
Please check the above sample, if it doesn’t meet your requirement, kindly share more clear information about your requirement. This will help us provide a prompt solution 

Regards, 
Prince 



SE Scott Eaton June 9, 2020 07:24 PM UTC

Is it possible to pass an ng-template component as content using the Dialog Angular service?  For example, can I replicate the following dialog component example using the service?
    <ejs-dialog id="editDlg" #editDlg
          [visible]='hidden'
          [isModal]='isModal'
          [animationSettings]='animationSettings'
          [showCloseIcon]='showCloseIcon'
          [header]='header'
          (open)="dialogOpen()"
          (close)="dialogClose()"
          [width]='width'>
          <ng-template #content>
              <app-edit-form *ngIf="modalContentSelect == 'edit'" [dataSource]="dataSource"></app-edit-form>
              <app-create-form *ngIf="modalContentSelect == 'create'"></app-create-form>
          </ng-template>
    </ejs-dialog>


SE Scott Eaton replied to Scott Eaton June 9, 2020 09:06 PM UTC

Is it possible to pass an ng-template component as content using the Dialog Angular service?  For example, can I replicate the following dialog component example using the service?
    <ejs-dialog id="editDlg" #editDlg
          [visible]='hidden'
          [isModal]='isModal'
          [animationSettings]='animationSettings'
          [showCloseIcon]='showCloseIcon'
          [header]='header'
          (open)="dialogOpen()"
          (close)="dialogClose()"
          [width]='width'>
          <ng-template #content>
              <app-edit-form *ngIf="modalContentSelect == 'edit'" [dataSource]="dataSource"></app-edit-form>
              <app-create-form *ngIf="modalContentSelect == 'create'"></app-create-form>
          </ng-template>
    </ejs-dialog>

Please disregard. I was able to refactor the code to utilize the parent/child example.


IS Indrajith Srinivasan Syncfusion Team June 10, 2020 12:37 PM UTC

Hi Scott,

We are glad that you found solution, with the already shared sample. Please let us know if you need any further assistance.

Regards,
Indrajith

Loader.
Live Chat Icon For mobile
Up arrow icon