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

Dialog in service

Hi Team,


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

5 Replies

PO Prince Oliver Syncfusion Team 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 



JR Jaco Roux 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





IS Indrajith Srinivasan Syncfusion Team 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 



SS Sanjay Singh June 5, 2022 08:19 AM UTC

How can I invoke the service from a global error handler or global interceptor



VJ Vinitha Jeyakumar Syncfusion Team June 6, 2022 01:01 PM UTC

Hi Sanjay,


We have prepared a sample for your requirement to invoke dialog service on error handling pages. please check the sample below,


Regards,
Vinitha

Loader.
Live Chat Icon For mobile
Up arrow icon