[英]AngularJs clear form in Modal and set it ng-invalid
i have a small problem with Angular JS and modal bootstrap. 我对Angular JS和模式引导程序有一个小问题。
This is the scenery: I create a modal with bootstrap which contain a form. 这是风景:我用包含表格的引导程序创建了一个模态。 In this form i use angular validation with the built-in property formname.$valid
. 在这种形式中,我将角度验证与内置属性formname.$valid
。 When formname.$valid
is false i set a submit-button to Hidden, when formname.$valid
is true the same button is visible. 当formname.$valid
为false时,我将提交按钮设置为Hidden,当formname.$valid
为true时,相同的按钮可见。
The problem is when i submit the first time the form closing the modal and clear all the input type. 问题是当我第一次提交关闭模态的表格并清除所有输入类型时。 The second time i open the modal the property formname.$valid
is true, instead it has to bee false. 第二次我打开模态时,属性formname.$valid
为true,相反它必须为false。 Also the class of the form is set to ng-valid
, however it has to be ng-invalid
. 表单的类也设置为ng-valid
,但是必须是ng-invalid
。 How can i resolve this problem? 我该如何解决这个问题?
This is a jsfiddle demonstration which explains exactly my issue. 这是一个jsfiddle演示,它准确地解释了我的问题。
For the js fiddle project i reccomend you to use Chrome, because is the only browser i need to support (it's only a school project) 对于js小提琴项目,我建议您使用Chrome,因为这是我需要支持的唯一浏览器(这只是一个学校项目)
Thanks to all! 谢谢大家!
(sorry for my bad english) (对不起,我的英语不好)
You need to visit documentation for ui-bootstrap 您需要访问ui-bootstrap的文档
Documentation ui-bootstrap 文档ui-bootstrap
You include ui-bootstrap in your module and you don't use it for manage your modal 您将ui-bootstrap包含在模块中,并且不使用它来管理模态
Look at this plunker for use $modal
: 看看这个使用$modal
插件:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.