Custom Validation directive working on iOS but NOT Android


i have below directive for the username field which only accepts certain characters and lower case only, it works perfectly in iOS but the same piece of code does not work in Android, when i keep typing in Android, nothing was inserted in the input field.

angular.module('ionic').directive('customValidation', function(){
   return {
     require: 'ngModel',
     link: function(scope, element, attrs, modelCtrl) {

       modelCtrl.$parsers.push(function (inputValue) {
         if (inputValue){
            var transformedInput = inputValue.toLowerCase().replace(/[^a-z0-9._]/gi,''); 

         if (transformedInput!=inputValue) {

         return transformedInput;