我有一个添加产品表单。当用户提交时,我想向他展示带有重置值的新添加产品表单。我怎样才能在 angularjs 中实现这一点?
最佳答案
类似这样的事情。
HTML:
<form ng-submit="submit()">
<input type="text" ng-model="product.name">
<input type="submit" value="Submit">
</form>
Controller :
$scope.product = {
name: 'My product'
};
$scope.submit = function() {
// process the product data
// Reset the product on the scope
// which clears the form
$scope.product = {};
}
关于javascript - 如何清除 angular.js 中的 html 表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22398863/