Angular form validation

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

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
Copyright 01fade ©


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

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


<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>

		<script src=""></script>

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



/*Downloaded from */
angular.module('app', [])
  .controller('ItemController', function($scope) {
		$scope.ityped = function(){
/*			alert("typed");
*/		}