本文介绍了如何在 ANGULAR 2 中提交表单时重置表单验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须在验证的同时重置我的表单.有什么方法可以将表单的状态从 ng-dirty 重置为 ng-pristine.
I have to reset my form along with validation. is there any method to reset the state of form from ng-dirty to ng-pristine.
推荐答案
似乎还没有对此提供支持.我见过的一种解决方法是在提交后重新创建表单,这显然既麻烦又难看.
There doesn't seem to be support for that yet.A workaround I have seen is to recreate the form after submit which is obviously cumbersome and ugly.
另见
- https://github.com/angular/angular/issues/6196
- https://github.com/angular/angular/issues/4933
- https://github.com/angular/angular/issues/5568
- https://github.com/angular/angular/issues/4914
这篇关于如何在 ANGULAR 2 中提交表单时重置表单验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!