title: Angular [ngClass] should change navbar color on scrolling event
body: <p>I'm pretty much new in angular. I'm trying to achieve a functionality where the navbar will change from transparent to dark upon scrolling the page. But in my application the navbar remains transparent even after scrolling. How to achieve that?</p>
  
  <p>The code which I tried:</p>
  
  <p>HTML</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;nav class="navbar navbar-expand-lg fixed-top navbar-transparent" [ngClass]="{'navbar-inverse': scrollEvent($event)}"&gt;
  </code></pre>
  
  <p>angular component.ts</p>
  
  <pre class="lang-js prettyprint-override"><code>ngOnInit() {
          window.addEventListener('scroll', this.scrollEvent, true);
      }
  scrollEvent = (event: any): void =&gt; {
  
        }
  </code></pre>
  
  <p>css</p>
  
  <pre class="lang-css prettyprint-override"><code>.navbar-inverse {
      background-color: #918d8d;
  }
  </code></pre>