Kendo-angular: Dialog - provide service for creating dialogs

Created on 2 Dec 2016  路  4Comments  路  Source: telerik/kendo-angular

Currently the dialog cannot be opened without placing the dialog in the component template. For some scenarios like confirm dialogs, providing a service that creates the dialog is more convenient.

Something in the terms of:

// kendoDialog: DialogService

const dialog = kendoDialog.confirm()
      .title("Are you sure")
      .content("This operation cannot be undone. You may lose progress.")
      .ok("I understand what I'm doing")
      .cancel("Get me out of here!");

kendoDialog.show(dialog).then(function() {
  // dialog OK, proceed
}, function() {
  // dialog cancel, hide
});

Requested on StackOverflow.

Enhancement dialog

Most helpful comment

I like the idea of implementation from the ui-bootstrap ng2 team for this toppic

https://ng-bootstrap.github.io/#/components/modal

Its also important, that you can pass some data to the modal like a userId or more

All 4 comments

I like the idea of implementation from the ui-bootstrap ng2 team for this toppic

https://ng-bootstrap.github.io/#/components/modal

Its also important, that you can pass some data to the modal like a userId or more

This feature is now available in @progress/kendo-angular-dialog -- see the Dialog Service help topic for information on how to use it.

Can i add html?
For example.

const dialog: DialogRef = this.dialogService.open({
    title: "Please confirm",
    content: "<b>Are you sure></b>",
    actions: [
        { text: "No" },
        { text: "Yes", primary: true }
    ]
});

@bipin244 the dialog service does not compile HTML template dynamically. You can use a template or a component, as shown in the documentation.

Was this page helpful?
0 / 5 - 0 ratings