ipsos-components
Version:
Material Design components for Angular
46 lines (37 loc) • 1.17 kB
text/typescript
import {Component, ViewChild, TemplateRef} from '@angular/core';
import {MatDialog, MatDialogRef, MatDialogConfig} from '@angular/material';
export class DialogE2E {
dialogRef: MatDialogRef<TestDialog> | null;
templateRef: TemplateRef<any>;
constructor (private _dialog: MatDialog) { }
private _openDialog(config?: MatDialogConfig) {
this.dialogRef = this._dialog.open(TestDialog, config);
this.dialogRef.afterClosed().subscribe(() => this.dialogRef = null);
}
openDefault() {
this._openDialog();
}
openDisabled() {
this._openDialog({
disableClose: true
});
}
openTemplate() {
this.dialogRef = this._dialog.open(this.templateRef);
}
}
export class TestDialog {
constructor(public dialogRef: MatDialogRef<TestDialog>) { }
}