<!DOCTYPE html>
<html>
<head>
<script src="Scripts/angular.min.js"></script>
<style>
input.ng-invalid
{
background-color: red;
}
</style>
</head>
<body>
<form ng-app="" name="myForm">
Enter your name:<input name="txtName" ng-model="myTxt" required>
</form>
<p>If you write in the textbox, the red color will be lost.</p>
</body>
</html>