AngularJs。$ setPristine复位形式 [英] AngularJs .$setPristine to reset form

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

问题描述

我一直在挣扎,一旦表单提交重置形式。有人张贴了这个这里我想让它工作,但没有成功。这里是我的我的code为例

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(); 未设置精粹:{{$ user_form质朴}} 真正。见上面的例子。

$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=$p$pview

这篇关于AngularJs。$ setPristine复位形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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