DialogService

A service for opening Dialog windows dynamically
(see example).

Constructors

DialogService (resolver: ComponentFactoryResolver, containerService: DialogContainerService)

Parameters

resolver ComponentFactoryResolver
containerService DialogContainerService

Methods

open

Opens a Dialog window. Requires an element in the application that uses the
kendoDialogContainer directive.
Created Dialogs will be mounted in the DOM directly after that element.

@Component({
  selector: 'my-app',
  template: `
    <button kendoButton (click)="open()">Harmless button</button>
    <div kendoDialogContainer></div>
  `
})
export class AppComponent {
    constructor( private dialogService: DialogService ) {}

    public open() {
        var dialog = this.dialogService.open({
          title: "Please confirm",
          content: "Are you sure?",
          actions: [
            { text: "No" },
            { text: "Yes", primary: true }
          ]
        });

        dialog.result.subscribe((result) => {
          if (result instanceof DialogCloseResult) {
            console.log("close");
          } else {
            console.log("action", result);
          }
        });
    }
}

Parameters

options DialogSettings

The options that define the Dialog.

Returns

DialogRef - A reference to the Dialog object and the convenience properties.