Angular form validation

In this example below you will see how to do a Angular form validation with some HTML / CSS and Javascript

Thumbnail
This awesome code was written by 01fade, you can see more from this user in the personal repository.
You can find the original code on Codepen.io
Copyright 01fade ©

Technologies

  • HTML
  • JavaScript
<!DOCTYPE html>
<html lang="en" >

<head>
  <meta charset="UTF-8">
  <title>Angular form validation</title>
  
  
  
  
  
</head>

<body>

  <style>
.
</style>
<div ng-app="app" ng-controller="ItemController">
		<form name="keyForm">
	<input type="number" name="key" ng-model="matchKey" ng-minlength="4" ng-maxlength="4" ng-change="ityped()" required/>
<span ng-show="keyForm.key.$error.minlength">too short</span>
<span ng-show="keyForm.key.$error.maxlength">too long</span>
			<button ng-disabled="keyForm.$invalid" ng-hide="keyForm.key.$invalid">Go</button>
		</form>


		<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
  
  

    <script  src="js/index.js"></script>




</body>

</html>

/*Downloaded from https://www.codeseek.co/01fade/angular-form-validation-WvrRRY */
angular.module('app', [])
  .controller('ItemController', function($scope) {
		$scope.ityped = function(){
/*			alert("typed");
*/		}
  });

Comments