<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body ng-app="">
<form name="myForm">
<p>An error will be displayed when you type anything less than five characters in the input field:</p>
<input name="myInput" ng-model="myInput" ng-minlength="5">
<h1 ng-if="!myForm.myInput.$valid">The value is too short</h1>
</form>
<p>In this example, we will display an error if the field contains less than five characters.</p>
<p><b>Note:</b> If the field is empty, it is considered valid.</p>
</body>
</html>