47

Input maxlength does not work on Android - Ionic

 2 years ago
source link: https://www.codesd.com/item/input-maxlength-does-not-work-on-android-ionic.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Input maxlength does not work on Android - Ionic

advertisements

I have an input field and also i need to stop the user from typing more than the allowed character.

<input type="text" name="callsign" maxlength="7" >

It is working in browser.But not working on android devices?


Thanks for all your answers.Your answers didn't me a give a proper solution.Then i have created a directive for that.

directive.js

myApp.directive('limitChar', function() {
    'use strict';
    return {
        restrict: 'A',
        scope: {
            limit: '=limit',
            ngModel: '=ngModel'
        },
        link: function(scope) {
            scope.$watch('ngModel', function(newValue, oldValue) {
                if (newValue) {
                    var length = newValue.toString().length;
                    if (length > scope.limit) {
                        scope.ngModel = oldValue;
                    }
                }
            });
        }
    };
})

html

<input type="text" limit-char limit="7" >

Related Articles

event.preventDefault () does not work in Android Ionic

I am trying to build a input field which will only take number as input so it's input type is number. But the keyboard visible on Android device is having a "." button on keyboard, so I am trying to prevent that button. using below code onKeyDow

SimpleOnGestureListener code does not work in Android 2.2

I have some code that I wrote to implement a vertical swipe on a Gallery widget. It works great in Android 1.5 and 1.6 but does not work in Android 2.2 (I have yet to try it with 2.1). public class SwipeUpDetector extends SimpleOnGestureListener impl

Input validation does not work android studio

For some reason my input Validation is not working. Every time I put calculate it crashes "app" when it should have an error saying that I need to input height/weight. When I do input the numbers it does calculate. Thanks for the help :). I'm ne

MaxLength of TEdit does not work on Android with DELPHI XE7 (update 1)

Does anyone know why does not work MaxLength of TEdit on Android with DELPHI XE7 (update 1)? Is there any solution to overcome this problem?There is some problem in DELPHI XE7 update 1 (see my report QC 129171) You can overcam it with this little cod

JS - file onload () does not work with Android browser

I have a application similar to the example http://jsfiddle.net/jonathansampson/K3A9r/ But if I use this concept for file upload on a iPad/android it does not work. The image is not loaded into the browser wether with onload() nor with onloadend() ht

~ selector does not work in Android

This question already has an answer here: CSS - Sibling selector not working in android? 1 answer Here is my HTML <div class="test" onclick="this.querySelector('.rad').checked=true;"> <input type="radio" class="

The hidden entry does not work in Android mobiles?

I am using the digitalbush masked input jQuery plugin. It is working fine in web browsers and the iPhone browser perfectly, but it is not working for Android mobile devices. My issue : mask is in input field _ - _ - ___. When I type numbers it will 1

Logcat does not work in Android studio

I use android studio 0.4.2 and logcat does not work (its just empty). USB debugging is enabled, filters are disabled and log level is verbose. Any ideas?In logcat, try going to the bottom right corner where there is a ">>" and select that.

Jquery scrollLeft does not work on Android

The code below is not working in Android browser! How do I fix it? <input id="sannn" type="button" value="SAN" /> <div id="sann" style="width:640px; height:200px; overflow:scroll; border:solid 1px red;

Quantity & ldquo; Two & rdquo; Does not work in Android Strings-Resources Plural

Android allows translators to define Plurals. The following example works for me with locale 'en': <plurals name="numberOfSongsAvailable"> <item quantity="one">One song found.</item> <item quantity="other"

Data: uri for ical does not work on Android or iPhone

I'm attempting to create a calendar entry using ical on a mobile device using data:Uri as described in https://stackoverflow.com/a/4551467/90236. Now it works great on my desktop machine when I run this in Chrome and my calendar app is MS Outlook. Ba

JQuery does not work with Android browser

I have been using jquery for my web development for a while, and when i use android browser to view my work, i find out that all the jquery function like hide() show() doesn't seems to work. Can anyone validate this for me, I wonder why jquery is not

The CSS3 animation does not work on Android 4.2

I'm developing an app using Worklight where I need to put a small animated image using CSS. In tests on Android devices with version 4.4 works perfectly, I performed some tests on devices with Android 4.2 and 4.1 and this same animation does not work

The Android viewer pop-up menu does not work on Android 4.x devices

I have a problem with one of my WebView on Android 4.x devices. Android app has a Tabhost which contains Fragments. One of the fragments contains a webview. The displayed page has a dropdown menu like this: <select id="mySelect" name="my

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK