如何在 ANGULAR 2 中提交表单时重置表单验证 [英] How to reset form validation on submission of the form in ANGULAR 2

查看:37
本文介绍了如何在 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.

另见

这篇关于如何在 ANGULAR 2 中提交表单时重置表单验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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