title: How I can detect window resize instantly in angular 2?
body: <p>Some features in my component turn on or off depend on browser size, therefore I want to check browser width on resize event. However, I could do it using OnInit method. But I need to refresh browser when resize happened to update browser width</p>
  <pre><code> ngOnInit() {
       if (window.innerWidth &lt;= 767){
         ---- do something
        }
     }
  </code></pre>
  <p>I tried to use OnChanges method, but it does not work either.</p>
  <pre><code>OnChanges(changes:SimpleChanges){
  console.log( 'width:====&gt;' + changes[window.innerWidth].currentValue);
    if ( changes[window.innerWidth].currentValue &lt;= 767 ){
        ---- do something
  }
  </code></pre>
  <p>}</p>
  <p>is there any suggestions or alternative way to accomplish this?</p>