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.
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 ) {}
}
Improve the usability of the dialog service for custom dialogs.
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
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