material dialog- how to get response data .subscribe()
I wasn’t sure how to get the data back from the form in the dialog box. Turns I needed to subscribe to the dialog box.
Also, the close button in the upper right needed a cancel();
as always fyi/hth
<button class="close" mat-button (click)="cancel()" >X</button> <h4 mat-dialog-title>There are items in this category.</h4> <p> <button id="keepItemsConfirm" type="button" class="btn btn-default" mat-button [mat-dialog-close]="false" cdkFocusInitial> Keep the items, delete this category </button> </p> <button mat-button [mat-dialog-close]="true" class="btn btn-danger" cdkFocusInitial> Delete category and included items </button>
openTemplateDialogBox() { this.dialog.open(NewMasterCalendarComponent).afterClosed().subscribe(result=> { console.log(result) }); }