Sets maxlength validation error key if the value is longer than maxlength
Questions tagged [ng-maxlength]
17 questions
                    
                    36
                    
            votes
                
                7 answers
            
        ng-maxlength screws up my model
I'm trying to do a simple textarea with "so many chars remaining" along with validation.
when I use ng-maxlength to validate my form, it resets my charcount as soon as the length hits the max length.  Here's the plunkr  Any workarounds?
  
        
            
            
                
                    
    
    
        
    
    
                
            
        
    
        Riz
        
- 6,486
 - 19
 - 66
 - 106
 
                    7
                    
            votes
                
                3 answers
            
        AngularJS + TinyMCE: ng-maxlength is not working on
I want to limit max text length so it doesn't exceed a column length in a DB. I've put this limitation on backend, and now I want to enforce it on frontend.
I use TinyMCE v4.3.3 with angular-ui-tinymce v0.0.12 plugin and AngularJS v1.4.6.
JS:
var…
        
        naXa stands with Ukraine
        
- 35,493
 - 19
 - 190
 - 259
 
                    6
                    
            votes
                
                2 answers
            
        why does angularjs blank out the input field when ng-maxlength is exceeded on initialization?
If I have an input text field whose value is exceeding the ng-maxlength upon form load (the input is still $pristine, not $dirty), the input field is misleadingly blank, while the ng-model still has…
        
        Homan
        
- 25,618
 - 22
 - 70
 - 107
 
                    5
                    
            votes
                
                1 answer
            
        AngularJS text input validation with counter
I'm developing an app containing a form which has a text input with ng-model="description".
Now I want to validate this text input using ng-maxlength="50" and required. This works fine, but I also want to add a character counter (like 67/50) shown…
        
        dduupp
        
- 291
 - 2
 - 3
 - 11
 
                    4
                    
            votes
                
                1 answer
            
        Does AngularJS store a value in the $error.maxlength object?
I've got a UI page setup through Angular, and I'm trying to take advantage of the built in ng-maxlength validator on an input element. Long story short, I know about $scope.form.$error and how that object has a maxlength property in the case that…
        
        Mike Young
        
- 1,297
 - 12
 - 15
 
                    2
                    
            votes
                
                0 answers
            
        ng-maxlength triggers onload and removes value
I currently have a website page in which the user can insert fields like GPS coordinates and a location. I've edited the page which puts a validator on the fields to check them for a maximum length. Current behaviour is that when the length exceeds…
        
        Joetjah
        
- 6,292
 - 8
 - 55
 - 90
 
                    2
                    
            votes
                
                1 answer
            
        Unable to get $error.maxlength validation in Directive
I am creating a directive that adds a template with text type input to the view. In this directive, I am trying to add the span class for error notification if the text field input is more than max length setting provided. I have a code something…
        
        Neel
        
- 9,352
 - 23
 - 87
 - 128
 
                    1
                    
            vote
                
                1 answer
            
        Limit characters in input box to non-numbers only with Angular
I see that a lot of people are using directives to solve this problem which I find annoying.  While I like directives it feels like massive overkill.
I have an input
        
            
            
                
                    
    
    
    
    
                
            
        
    
user6321478
                    1
                    
            vote
                
                0 answers
            
        ng-maxlength issues in angular 1.4.12
Previously in angular 1.3.20 I could write a directive that accepted the ng-maxlength attribute, and apply it to an input inside its template. The HTML with the template inserted would look like this:
    
        
            
            
                
                    
    
    
        
    
    
                
            
        
     
        Jameson Taylor
        
- 11
 - 1
 
                    1
                    
            vote
                
                1 answer
            
        Validate A-Z0-9 has maxlength 10, but allow user to enter spaces (but skip spaces in maximum)
I'm wondering if there is an easy way to set this validation on a form text field, without creating a custom directive.
I need to validate that {minlength: 2, maxlength: 10}, user can enter any combination of [A-Z0-9\s], but only the amount of…
        
        ngDeveloper
        
- 1,304
 - 2
 - 16
 - 34
 
                    0
                    
            votes
                
                1 answer
            
        angularjs, ng-model and maxlength: String was not truncated
If I have this html:
    
And this js (angularjs)
   $scope.person = {
       name: "Larger than 10"
   };
What I get, "rendered", is this:
But I was expecting that maxlength would…
        
        sports
        
- 7,851
 - 14
 - 72
 - 129
 
                    0
                    
            votes
                
                1 answer
            
        AngularJS - ngmaxlength not working with ng-required
Input Type
    
    
        
            
            
                
                    
    
    
        
    
    
                
            
        
    
                    
        Slimshadddyyy
        
- 4,085
 - 5
 - 59
 - 121
 
                    0
                    
            votes
                
                2 answers
            
        ng-repeat get length of array and bind last value of array
$scope.GetDetails={
  Student:[
      {"id":1,"Name":"Apple","Price":3500}
    ],
  Student:[
      {"id":2,"Name":"Samsung","Price":4000}
     ],
  Student:[
    {"id":3,"Name":"Nokia","Price":1500},
    {"id":3,"Name":"Nokia","Price";7000}
   ]
…
        
        Vediyappan.V
        
- 11
 - 3
 
                    0
                    
            votes
                
                2 answers
            
        How to show text length even if it exceed ng-maxlength?
I am not able to see character count which ng-maxlength reached. 
var app = angular.module('plunker', []);
app.controller('MainCtrl', function($scope) {
});