title: Can I use multiple @hostlistener or events based on browser?
body: <p>I'm using @hostlistener in Angular7 directive. Can I use more than one event on this?</p>
  <p>Problem is that listening for the 'keydown' event is fine on anything but Android as the latter has no key events.</p>
  <p>Switching to 'input' event solves this problem but doesn't cover Firefox (and probably Edge) as there's no 'inputType' (and other things) on the latter which causes the actual input field to allow any input.</p>
  <p>So my goal is to be able to use 'keydown' for Firefox and Edge and use 'input' for anything else. Is that possible?</p>
  <p>Used 'keydown', 'keypress' and 'input' events</p>
  <pre><code>    @HostListener('input', ['$event'])
      onInput(event: any) {
          this.parseKeyDown(event);
      }
  </code></pre>
  <pre><code>    parseKeyDown(event: any) {
          if (event.inputType === 'deleteContentBackward' || event.inputType === 'deleteContentForward') {
              let str = this.ngModel.substr(0, this.ngModel.length - 1);
              if (str.length === 0) {
                  str = '0';
              }
              // handle 'str'
          }
  ...
          if (e.inputType === 'insertText' &amp;&amp; e.data.match(this.regex)) {
              // handle ngModel
          }
      }
  </code></pre>
  <p>Code shortened for readability.</p>
  <p>This works in anything but Firefox/Edge where pressing backspace or delete keys deletes the last char. In Firefox the field just falls back to a text field, allows any GUI input and doesn't update ngModel.</p>
  <p>Since there's no 'inputType' in Firefox nothing happens.</p>
  <hr />
  <p>EDIT My solution</p>
  <pre><code>    @HostListener('keydown', ['$event'])
      @HostListener('input', ['$event'])
      onInput(e: any) {
          this.parseKeyDown(e);
      }
  
      parseKeyDown(e: any) {
          const key = e.key;
          if (key) { // Browsers WITH key events
  ...
          } else { // Browsers WITHOUT key events
              const data = e.data;
              const inputType = e.inputType;
  ...
  </code></pre>