Replacement for Angular MatDialog using Kendo Angular Dialog

1 Answer 300 Views
Dialog
Vrushak
Top achievements
Rank 1
Vrushak asked on 15 Jun 2021, 11:01 AM

 

We are implementing the Kendo dialog box using angular, and we want to access the dialog box component from a service. Currently this is achieved through material dialog box.

Below code for reference using material dialog

MyService.ts

import { Injectable } from '@angular/core';

import { MatDialog } from '@angular/material/dialog';
import { WarningBoxComponent } from './warning-box/warning-box.component';

@Injectable({
  providedIn: 'root'
})
export class MessageBoxService {
  constructor(public dialog: MatDialog) { }

  public OpertaionNotAllowed(fieldName: string): void {
    this.dialog.open(WarningBoxComponent, {
      data: {
        boxTitle: 'Not Allowed!',
        errorMessage: fieldName + ' operation is not allowed..!'
      }
    });
  }
We can render our component within Mat Dialog box and also pass data to it from service as shown above. Is there any way we can achieve this using kendo dialog as well?

1 Answer, 1 is accepted

Sort by
0
Stoyan
Telerik team
answered on 17 Jun 2021, 03:01 PM

Hello Vrushak,

Thank you for the provided code snippet.

The developer can achieve similar functionality by using our DialogService. Please check the following article for more details on how to render a component instance as Dialog content:

https://www.telerik.com/kendo-angular-ui/components/dialogs/dialog/service/#toc-content-component

Let us know in case additional information is needed.

Regards,
Stoyan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Dialog
Asked by
Vrushak
Top achievements
Rank 1
Answers by
Stoyan
Telerik team
Share this question
or