title: Custom dialog with @HostListener in Angular
body: <p>I am trying to ask the user, after making unsaved changes and refreshing the page, if he wants to discard these changes and reload the page or cancel the refresh.
  I want to use my own dialog instead of the browser's one.
  Is that possible with  @HostListener('window:beforeunload')?</p>