How to restrict input textbox to enter numbers only in Angular2 form?
<p>I have to restrict user to enter only numbers in a field in Angular2->form 
I have solution but backspace is not working in input field 
Can anybody have proper solution for that?</p>

<p>form.html</p>

<p><code>&lt;input (keypress)="keyPress($event)" minlength="8" maxlength="15" required /&gt;</code></p>

<p>form.component.ts</p>

<pre><code>keyPress(event: any) {
    const pattern = /[0-9\+\-\ ]/;
    let inputChar = String.fromCharCode(event.charCode);
    // console.log(inputChar, e.charCode);
       if (!pattern.test(inputChar)) {
       // invalid character, prevent input
           event.preventDefault();
      }
 }
</code></pre>

<p>On kepress event it restrict user to enter only numbers but problem with this code is backspace, tab keys are not working.So, this code is not as per my expectation...</p>