Angular:Override default popup on browser refresh

I have implemented a warning popup to indicate that Your changes will lost using the hot listener

@HostListener('window:beforeunload', ['$event'])
  unloadNotification($event: any) {
    if (!this.canDeactivate()) {
      $event.returnValue = `You have unsaved changes`;
    }
  }

I can see the popup but that's the default popup from the browser so is it possible to override that with a custom popup (like angular material dialog)



Read more here: https://stackoverflow.com/questions/67395576/angularoverride-default-popup-on-browser-refresh

Content Attribution

This content was originally published by iam batman at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: