I am trying to add an Angular Material dialog box(just a title and yes/no) that gets called before my web service executes. The thing is that I do not want to create the dialogs HTML in a separate component. I need the dialogs HTML to be in the same file as my existing code. The dialog needs to open when I click on the callAPI button.
Here is my existing component code
<mat-tab-group>
<mat-tab label="Tab 1">
<button mat-flat-button color="warn" (click)="callAPI()">Open Dialog</button>
</mat-tab>
<mat-tab label="Tab 2">
</mat-tab>
</mat-tab-group>
callAPI() {
this.http.get<any>('https://example.com/api').subscribe(data => {
this.data = data;
this.loading = false;
},
err => {
this.loading = false;
});
}