Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
dialog parent example from route
selector: 'dialog-parent-example',
templateUrl: 'dialog-parent-example.html',
styleUrls: ['dialog-parent-example.css'],
export class DialogParentExample {
routeQueryParams: Subscription;
constructor(public dialog: MatDialog, private route: ActivatedRoute) {}
ngOnInit() {
this.routeQueryParams = route.queryParams.subscribe(params => {
if (params['dialog']) {
ngOnDestroy() {
openDialog(): void {
const dialogRef =, {
width: '250px',
data: {name: 'Sample Dialog'}
dialogRef.afterClosed().subscribe(result => {
console.log('The dialog was closed', result);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.