Execute
<!DOCTYPE html> <html> <head> <title>Wikitechy AngularJS Tutorial</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.5.6/angular.min.js"></script> </head> <body> <form ng-app="" name="form" ng-init="maxlength=5" > <h3>ng-maxlength Directive example in AngularJS Tutorial</h3> Set a maxlength <input type="number" ng-model="maxlength" /> <br/><br/> Enter the text or Number: <input type="text" ng-model="value" name="input" ng-maxlength="maxlength" /><br/><br/> <p>Form.input.$valid = {{form.input.$valid}}</p> <p>Model = {{value}}</p> </form> </body> </html>
www.wikitechy.com © Copyright 2016. All Rights Reserved.