Goal: I want a mat-dialog to show when the page is loaded.
Problem: I noticed that the ngOnInit is triggered twice when I have a mat-dialog in there.
What I've tried: I have tried moving it around to different methods but it seems to have no difference. Ive also looked through some SO articles but not sure I am understanding the answer. I see some mentioning the change detection.
Angular Material Dialog is displaying twice
Typescript:
ngOnInit()
{
sessionStorage.setItem('InActiveV', "false");
// Start v in API and get info
const staring = timer(500, 10000);
this.startVSubscription = staring.subscribe(val =>{
if (!this.isLoad) {
this.PStartV();
}
else {
this.startVSubscription.unsubscribe();
}
});
this.cmdOpenDialog_click();
}
cmdOpenDialog_click() {
this.dialog.open(DialogInternalNotesThreeComponent, {
data: {
data: this.internalNotes
}
});
}