angularjs - Ionic: RegExp .test() function not working in android device -


i write funtion using .test(string) let input allow number , backspace key. when test in ionic serve or ios, worked. when test in android not working, input field allow character inputed. when use console.log(event), return key=unidentified.

i dont know how fix this, give me advise, plz!

.ts file

import {component} '@angular/core'; import {navcontroller} 'ionic-angular';  @component({   selector: 'page-home',   templateurl: 'home.html' }) export class homepage {   constructor(public navctrl: navcontroller) {    }    isvalidnumber(event) {     return /\d|backspace/.test(event.key);    } } 

.html file

<ion-header>   <ion-navbar>     <ion-title>home</ion-title>   </ion-navbar> </ion-header> <ion-content>   <ion-item>       <ion-input  type="text" (keydown)="isvalidnumber($event)"></ion-input>   </ion-item>  </ion-content> 

test in android version 5.5.1


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -