angular - ionic 2 custom directives not working in android 5 -


i have custom directive below limit number of characters in input field in ionic 2 app. see below. unfortunately works in android 4.2.2 not on android 5.1.1. can help?

    import { directive, input, hostlistener } '@angular/core';  /*   generated class limitto directive.    see https://angular.io/docs/ts/latest/api/core/index/directivemetadata-class.html   more info on angular 2 directives. */ @directive({   selector: '[limit-to]' // attribute selector }) export class limitto {    @input('limit-to') limitto;    constructor() {    }   //hostlistener decorator handle event handlers input (onkeypress)   @hostlistener('keypress', ['$event'])   onkeypress(ev) {     const limit = +this.limitto; //convert number     // once reaches limit set, stop propgating event.     if (ev.target.value.length === limit) {       ev.preventdefault();     }   }  } 

thank you, ashley


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -