title: Angular 7 window resize event not running in service
body: <p>I have the following service with a ReplaySubject variable that I would like to use in components, and my understanding is that it should work, but the WindowResize event isn't firing at all.</p>
  
  <pre><code>import { Injectable, HostListener } from '@angular/core';
  import { ReplaySubject } from 'rxjs';
  
  @Injectable({
      providedIn: 'root'
  })
    export class WindowResizeService {
  
      windowWidth;
  
      constructor() {
        console.log("Window resize service active");
        this.windowWidth = new ReplaySubject(1);
      }
  
      @HostListener('window:resize', ['$event'])
      onResize(event) {
        console.log("Width: " + event.target.innerWidth);
        this.windowWidth.next(event.target.innerWidth);
      } 
  }
  </code></pre>
  
  <p>In the component, I've subscribed in the following way:</p>
  
  <pre><code>import { WindowResizeService } from './window-resize-service';
  
  constructor(private windowResize: WindowResizeService) implements OnInit {
  
  }
  
  ngOnInit() {
      this.windowResize.windowWidth.subscribe(
          (value) =&gt; { console.log(value) }
      );
  }
  </code></pre>
  
  <p>So I get the <code>Window resize service active</code> event, but the <code>console.log</code> in the Service or the Component aren't being ran. Any help is appreciated, thanks :)</p>