0

我正在尝试清除表格,但仍然面临一些问题。如何清除提交时的表单?

HTML

<form id="contact" class="contact-form" ng-submit="sendMail()" novalidate ng-controller="QuoteCtrl">
<div class="message"></div>
 <div class="col-md-5 col-sm-5 col-xs-12 animated hiding" data-animation="slideInLeft">
  <div class="form-group">
    <input type="text" name="name" class="nameform form-control input-lg" placeholder="name" ng-model="message.contactName" required>
  </div>     
</div>

<div class="col-md-7 col-sm-7 col-xs-12">
    <input type="submit" class="btn btn-custom up form-button" value="Send Message">

app.controller('QuoteCtrl', ['$scope', '$interval', '$http', 
function($scope, $interval, $http) {
    $scope.message = {};
   $scope.sendMail = function () {
      $http.post('/send/sendQuote', $scope.message).
        success(function(data) {
         $scope.message = data.message;
         console.log($scope.message);
         $scope.message = {};
      });
   }
}]);

清除表单的主要技术有哪些,包括 setPrestine()?

4

1 回答 1

1

试试吧。它会正常工作的

$http.post('/send/sendQuote', $scope.message).
        success(function(data) {
         $scope.message = data.message;
         console.log($scope.message);
         $scope.message.contactName=null;
      });
于 2016-07-06T09:30:25.143 回答