【发布时间】:2015-09-09 07:17:54
【问题描述】:
我正在使用 AngularJS v1.3.16。我想重置表单。
我尝试了$pristine、$dirty 和$setPristine(),但收到了错误消息:
HTML:
<form id="userForm" class="form-horizontal ut-form form-validation" role="form" name="userForm" novalidate>
.........
</form>
代码:
$scope.createUser = function () {
$scope.page.view = 'create';
$scope.account = "";
$scope.userForm.$pristine = true;
}
错误信息:
$setPristine()- 类型错误:无法读取属性'$setPristine'ofundefined$pristine- 类型错误:无法设置属性'$pristine'ofundefined
请任何人建议我如何解决这个问题。
【问题讨论】:
-
或许也可以在这里发布错误消息。
-
你在哪里调用
reset方法? -
它可能有效,请尝试 ANUSHA --- stackoverflow.com/questions/16759221/…
-
@Vineet 我已经检查过这个链接,但没有用。我按照这个例子试过了
标签: html angularjs form-control