Home
Run »
<!DOCTYPE html> <html ng-app="ngMessagesInclude"> <head> <!-- www.techstrikers.com --> <title>AngularJS ngMessage Sample</title> <script> document.write('<base href="' + document.location + '" />'); </script> <link rel="stylesheet" href="style.css" /> <script src="https://www.techstrikers.com/AngularJS/Includes/angular.min.js"></script> <script src="https://www.techstrikers.com/AngularJS/Includes/angular-messages.js"></script> <script> var app = angular.module('ngMessagesInclude', ['ngMessages']); app.controller('ngMessagesInclude', function($scope) { $scope.name = 'World'; }); </script> </head> <fieldset style="background-color:#DDE4E9;"> <legend>AngulerJS ngMessagesInclude Example</legend> <body ng-controller="ngMessagesInclude"> <form name="myForm"> <div style="font-family:Arial;margin:10px;width:350px;"> <label>Enter first name:</label> <input type="text" name="firstName" ng-model="name1" required minlength="5" maxlength="20"/><br> <label>Enter last name:</label> <input type="text" name="lastName" ng-model="name2" required minlength="5" maxlength="20"/><br/><br/> </div> <div ng-messages="myForm.firstName.$error"> <div ng-messages-include="errorMessages.html"></div> </div> </form> </fieldset> </body> </html>