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
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Dialog in service

Thread ID:

Created:

Updated:

Platform:

Replies:

145814 Jul 9,2019 01:47 PM UTC Dec 8,2020 10:25 AM UTC Angular - EJ 2 3
loading
Tags: Dialog
Marko
Asked On July 9, 2019 01:48 PM UTC

Hi Team,


How I can use Dialog and Notification in service in entryComponents?
Example:
Regards

Prince Oliver [Syncfusion]
Replied On July 10, 2019 05:08 AM UTC

Hi Marko, 

Thank you for contacting us. 

You can use the Dialog component and Toast 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 for Dialog Component.  


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. 

For Toast Component, please refer to the following KB documentation: https://www.syncfusion.com/kb/10340/how-to-use-toast-as-an-angular-service 

Kindly check the above solution and let us know if you need any further assistance on this. 

Regards, 
Prince 


Jaco Roux
Replied On December 7, 2020 11:45 AM UTC

Is it possible to render other components or ng-templates as part of the content property of the dialog service?

Currently I use 


<div #modal>
  <ng-container *ngIf="showModal">
    <div *ngTemplateOutlet='content'></div>
  </ng-container>
</div>

<ng-template #content>
  <h1>Hello world</h1>
</ng-template>


And in the component code:

@ViewChild('modal', { statictrue }) modalElementRef;


Then pass in nativeElement of modal as the content
this.modal.nativeElement




Indrajith Srinivasan [Syncfusion]
Replied On December 8, 2020 10:25 AM UTC

Hi Jaco,

Greetings from Syncfusion support,
 
 
We have validated your reported query. Yes, you can render the dialog using the ng-templates. We have also prepared a sample that tries to meet your requirements. 
 
 
Can you please check the above sample and let us know if it meets your requirements ? 
 
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