Last active
June 27, 2018 21:44
-
-
Save danielkuhlwein/9ca80148f096e0e9b838b8fd0c83b522 to your computer and use it in GitHub Desktop.
Usage Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constructor(public dialog: MatDialog) { } | |
openDialogSimple() { | |
const dialogRef = this.dialog.open(DialogComponent, { | |
width: '500px', | |
panelClass: 'ss-dialog', // always include this property of MatDialogConfig! | |
}); | |
// Listen for which button was pressed and act accordingly | |
dialogRef.afterClosed().subscribe(result => { | |
if (result === 'leave') { | |
console.log('Yes, I am sure I want to leave the page.'); | |
} | |
if (result === 'stay') { | |
console.log('No, I want to stay!'); | |
} | |
}); | |
} | |
openDialogComplex() { | |
const dialogRef = this.dialog.open(ComplexDialogComponent, { | |
width: '500px', | |
panelClass: 'ss-dialog', // always include this property of MatDialogConfig! | |
}); | |
// Listen for which button was pressed and act accordingly | |
dialogRef.afterClosed().subscribe(result => { | |
if (result === 'Operation Cancelled') { | |
alert('Date selection cancelled'); | |
} else { | |
alert('The date you selected was:\n' + result); | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment