JSFiddle - React, Tailwind, and code Playground

HTML

<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<div ng-app="" ng-controller="formCtrl">
    <form novalidate="" name="myform" ng-submit="validate()">
        <input name="formvalue" type="text" ng-model="formvalue" required />
        <input type="submit"/>
    </form>
</div>

CSS

input.ng-dirty.ng-invalid { background-color: red }

JavaScript

formCtrl = function($scope){
    
    $scope.validate = function(){
               
         for (feild in $scope.myform) {
             // look at each form input with a name attribute set
             // checking if it is pristine and not a '$' special field
             if (feild[0] != '$' && $scope.myform[feild].$pristine) {
                  $scope.myform[feild].$setViewValue(
                      $scope.myform[feild].$modelValue
                  );
             }
             
         }   
    };
}