在AngularJS中单击事件时重置表单

在AngularJS中单击事件时重置表单,angularjs,forms,Angularjs,Forms,在AngularJS中,有谁能建议一种简单的方法来重置或重新加载一个HTML表单点击事件吗?您可以使用angular.copy({},yourform)将空数组复制到表单对象,如下所示 $scope.resetForm = function(form) { angular.copy({}, form); } Html 工作到目前为止,您尝试了什么?网上有很多关于这方面的信息,等等。参见 <form> <input type="text" ng-model

在AngularJS中,有谁能建议一种简单的方法来重置或重新加载一个HTML表单点击事件吗?

您可以使用angular.copy({},yourform)将空数组复制到表单对象,如下所示

$scope.resetForm = function(form) {
     angular.copy({}, form);
}
Html



工作

到目前为止,您尝试了什么?网上有很多关于这方面的信息,等等。参见
<form>
    <input type="text" ng-model="myForm.myName" />
    <input type="text" ng-model="myForm.adress" />
    <input type="button" value="reset" ng-click="resetForm(myForm)" />
</form>