Number only directive works on pc but not in mobile

Hi guys, I have a directive that allows user input only integer numbers, it’s working fine on desktop chrome and firefox, but it’s not working on device (it accepts dot and comma, for example).
Can you help me? Here is the code.
By the way, I just tried the input types: tel, number and text, it works only on desktop.


<ion-label floating color="secondary">Levantamento Atual</ion-label>
<ion-input type="tel" formControlName="avaliacao_atual" integerOnly></ion-input>


import { Directive, HostListener } from '@angular/core';
    selector: '[integerOnly]'
export class NumberOnlyDirective {
    onkeypress(e) {
        let event = e || window.event;
        if (event) {
            return this.isNumberKey(event);
    isNumberKey(event) {
        let charCode = event.which ? event.which : event.keyCode;
        if (charCode > 31 && (charCode < 48 || charCode > 57)) {
            return false;
        return true;