Angular2 input type number, no decimal value
<p>I've been wondering, what is the proper approach in preventing decimals from being entered in number inputs for angular2.</p>

<p>Is there a certain event or constraint I can add?
When I for example just use pattern or such it will only invalidate the field but still allow typing.</p>

<p>What would be the proper way to prevent this, just ye olde, keyUp event and checking keystroke?</p>

<p>Since according to comments, asking for patterns or w/e is wrong, here is what I now implemented and works like a charm</p>

<pre><code>&lt;input (keypress)="preventInput($event)" type="number" step="1"&gt;
</code></pre>

<p>with preventInput as:</p>

<pre><code>private preventInput(event) {
  console.log(event.keyCode);
  switch(event.keyCode) {
    case 101: //e
    case 46: //.
      event.preventDefault();
      break;
  }
}
</code></pre>

<p>this won't however prevent input of . by pasting but is good enough for us.</p>