How can I do ng-minlength, ng-maxlength validations correctly in angular.js?

  angularjs, validation

In the project, required, max-size-number, min-size-number parts work, but pattern, minlength, and maxlength parts dont work,

How can I correct this?

here is the related code part;

<div ng-if="componentValidationType[component.shortName] == validationType.VALIDATION">
                            <div  style="color: red"
                                ng-messages="getFormValidations(form.shortName)['name'+component.shortName].$error"
                                ng-show="isInAdminFormPage && formInf.mainForm.$submitted">
                                <div ng-message="required" >{{message["required"]}}</div>
                                <div ng-message="minlength">{{message["minlength"]}}</div>
                                <div ng-message="maxlength">{{message["maxlength"]}}</div>
                                <div ng-message="ng-pattern">{{message["ng-pattern"]}}</div>
                            </div>
                            <div ng-if="isInAdminFormPage" style="color: orange"
                                    ng-show="showValidationMessageOfTextBox(component.shortName)  && formInf.mainForm.$submitted">
                                    <div ng-show="!maxNumberValidation[component.shortName].validation">{{message["max-number-size"]}}</div>
                                    <div ng-show="!minNumberValidation[component.shortName].validation">{{message["min-number-size"]}}</div>

                                </div>
                        </div>   

Source: AngularJS Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.