How can I listen for keypress event on the whole page?
<p>I'm looking for a way to bind a function to my whole page (when a user presses a key, I want it to trigger a function in my component.ts)</p>

<p>It was easy in AngularJS with a <code>ng-keypress</code> but it does not work with <code>(keypress)="handleInput($event)"</code>. </p>

<p>I tried it with a div wrapper on the whole page but it doesn't seem to work.
it only works when the focus is on it.</p>

<pre class="lang-xml prettyprint-override"><code>&lt;div (keypress)="handleInput($event)" tabindex="1"&gt;
</code></pre>