Angular 2.0是否有类似于Angular 1中的`$ setPristine`函数? [英] Does Angular 2.0 have something similar to `$setPristine` function in Angular 1?

查看:110
本文介绍了Angular 2.0是否有类似于Angular 1中的`$ setPristine`函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

提交表单后,输入的 pristine 状态仍为false。我不知道如何重置 pristine 状态为true。在Angular 1中,我将使用 $ setPristine 函数。

解决方案

有一个拉取请求正在等待添加 https://github.com/angular/angular/pull/6679
另请参阅此相关问题 https://github.com/angular/angular/issues/4933



通常使用的解决方法是重新创建表单。

After submitting the form, the pristine state of the input is still "false". I don't know how to reset the pristine state to be true. In Angular 1, I would use the $setPristine function.

解决方案

There is a pull request waiting to be added https://github.com/angular/angular/pull/6679 See also this related issue https://github.com/angular/angular/issues/4933

The usually used workaround is to recreate the form.

这篇关于Angular 2.0是否有类似于Angular 1中的`$ setPristine`函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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