<!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");
*/ }
});