<!DOCTYPE html>
<html lang="zh-CN" ng-app="app">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link type="text/css" rel="stylesheet" href="css/angular.css"></link>
<script src="js/angular.min.js"></script>
</head>
<body ng-controller="formCtrl">
<form name="test" novalidate role="form">
<input type="email" name="email" ng-model="info.email" required>
<p class="ng-hide" ng-show="test.email.$invalid && test.email.$dirty">填写文件</p>
</form>
<button ng-click="reset()">重置</button>
<script type="text/javascript">
var app = angular.module(‘app‘,[]);
app.controller(‘formCtrl‘, [‘$scope‘, function($scope){
$scope.info = {};
$scope.reset = function(){
$scope.info.email=‘‘;
$scope.test.$setPristine();
}
}]);
</script>
</body>
</html>
原文:http://www.cnblogs.com/haitangxun/p/5325054.html