Kendo-angular: Allow complete content of dialog to be passed to the service

Created on 30 Oct 2017  路  7Comments  路  Source: telerik/kendo-angular

I'm submitting a...

  • Suggestion for improvement

Current behavior

The current dialog service API works great for simple text dialogs. However, passing custom actions is involved, and follows a strange pattern. There is no way to keep the dialog content and actions together when opening a dialog from a service.

Expected behavior

Ideally, the dialog service should be able to open a dialog from a defined component:

class AppComponent {
  constructor( private dialogService: DialogService ) {}

  public showCustomDialog() {
      const dialog = this.dialogService.open(CustomDialogComponent);
      dialog.result.subscribe(res => console.log(res));
  }
}
@Component({
    template: `
        <kendo-dialog-title>Custom title</kendo-dialog-title>

        Custom dialog content.

        <kendo-dialog-actions>
              <button kendoButton (click)="dialog.close({ result: false })">No</button>
              <button kendoButton (click)="dialog.close({ result: true })" [primary]="true">Yes</button>
        </kendo-dialog-actions>
    `
})
class CustomDialogComponent {
    constructor( public dialog: DialogRef ) {}
}

What is the motivation or use case for changing the behavior?

Improve the usability of the dialog service for custom dialogs.

Enhancement dialog

Most helpful comment

Hi guys,

You can check out the development version of the package that contains the discussed enhancement:

https://www.telerik.com/kendo-angular-ui-develop/components/dialogs/dialog/service/#toc-passing-title-content-and-actions-as-a-single-component

All 7 comments

I think it is really important to have same approach using component or template (same css customisation here for actions). Right now i'm implementing dialog component with dialogService and i just would like to use common approach.

Is there an estimation when this feature will be available?

We need this kind of approach.

Shall we file a feature request at the feedback portal?

Hi guys,

You can check out the development version of the package that contains the discussed enhancement:

https://www.telerik.com/kendo-angular-ui-develop/components/dialogs/dialog/service/#toc-passing-title-content-and-actions-as-a-single-component

Released in 3.10.0

Was this page helpful?
0 / 5 - 0 ratings