AngularJs .$setPristine 重置表单 [英] AngularJs .$setPristine to reset form

查看:22
本文介绍了AngularJs .$setPristine 重置表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

提交表单后,我一直在努力重置表单.有人发布了这个这里,我想让它工作但没有成功.这是我的我的代码示例.

I been struggling to reset form once form is submitted. Someone posted this Here which I want to make it work but no success. Here is my My Code Example.

$scope.form.$setPristine(); 没有将 Pristine: {{user_form.$pristine}} 设置为 true.请参阅上面的示例.

$scope.form.$setPristine(); is not setting Pristine: {{user_form.$pristine}} to true. See example above.

推荐答案

$setPristine() 是在 angularjs 的 1.1.x 分支中引入的.您需要使用该版本而不是 1.0.7 才能使其正常工作.

$setPristine() was introduced in the 1.1.x branch of angularjs. You need to use that version rather than 1.0.7 in order for it to work.

参见 http://plnkr.co/edit/815Bml?p=preview

这篇关于AngularJs .$setPristine 重置表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆