title: how to perform window.onclick() on angular (v4+)
body: <p>I have been trying to close a drop-down on-click outside of the invoking button(ie. window). Using javascript it was easy as i could simply </p>
  
  <pre><code>  // Close the dropdown menu if the user clicks outside of it
  window.onclick = function (event) {
  if (!event.target.matches('.bulk-dropbtn')) {
  
    var dropdowns = document.getElementsByClassName("bulk-dropdown-content");
    var i;
    for (i = 0; i &lt; dropdowns.length; i++) {
      var openDropdown = dropdowns[i];
      if (openDropdown.classList.contains('show')) {
        openDropdown.classList.remove('show');
      }
    }
   }
  }
  </code></pre>
  
  <p>But I guess typescript doesn't support this, as I am getting an error on window.onclick [ts] ';' expected.</p>
  
  <p>Is there any other method I can perform an onClick detection on typescript without compromising on performance</p>