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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Single Dialog Box Use in Multiple Pages

Thread ID:

Created:

Updated:

Platform:

Replies:

145572 Jun 28,2019 10:51 AM UTC Jun 10,2020 12:37 PM UTC Angular - EJ 2 6
loading
Tags: Dialog
sunithra
Asked On June 28, 2019 01:06 PM UTC

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

Prince Oliver [Syncfusion]
Replied On 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 


sunithra
Replied On 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 

Prince Oliver [Syncfusion]
Replied On 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 


Scott Eaton
Replied On 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>

Scott Eaton
Replied On 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.

Indrajith Srinivasan [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon