x
 
<!DOCTYPE html>
<html>
<script src="https://cdn.staticfile.net/angular.js/1.6.9/angular.min.js"></script>  
<style>
form.ng-pristine {
    background-color: lightblue;
}
form.ng-dirty {
    background-color: pink;
}
</style>
<body ng-app="">
<form name="myForm">
<p>请试着在输入框中输入内容:</p>
<input name="myName" ng-model="myName" required>
<p>当表单被修改后,会获得“ng-dirty”类,因此背景会变成粉色。</p>
</form>
</body>
</html>