我有一个添加产品表单。当用户提交它时,我想向他展示带有重置值的新添加产品表单。我怎么能实现这个是angularjs?
答案 0 :(得分:4)
像这样。
HTML:
<form ng-submit="submit()">
<input type="text" ng-model="product.name">
<input type="submit" value="Submit">
</form>
控制器:
$scope.product = {
name: 'My product'
};
$scope.submit = function() {
// process the product data
// Reset the product on the scope
// which clears the form
$scope.product = {};
}