Skip to main content

Posts

Showing posts with the label ng-minlength

ng-minlength, ng-maxlength and ng-required in AngularJs

The ng-minlength, ng-maxlength and ng-required are used to validate  the input field. The ng-minlength is used to validate the min-length of a input field that is define by you that means what you want to your input field minlength. i.e. name: {     minlength: 5 } The ng-maxlength is used to validate the max-length of a input field that is define by you that means what you want to your field maxlength. i.e. name: {     maxlength: 25 } The ng- required is used to validate the required an input field. If a field contain length grater then zero that means its contain some value otherwise its required. i.e. name: {     required: true } Go to live demo link http://embed.plnkr.co/2ngL0R/preview The AngularJs code-sample as given below. var app = angular.module( "myApp" , []); app.controller( 'myCtrl' , function ($scope) {     $scope.user = {      ...