如何禁用角外部按钮时,表格无效 [英] how to disable external button in angular when form is invalid
本文介绍了如何禁用角外部按钮时,表格无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个这样的多种形式的:</ p>
I have a multiform like this :
<form id="signup-form" name="frm" ng-submit="processForm()" novalidate>
<!-- our nested state views will be injected here -->
<div id="form-views" ui-view></div>
</form>
<pre>
{{ formData }}
<input type="button" value="ذخیره" class="btn btn-primary" ng-click="$broadcast('Save')" />
我
如何禁用和启用按钮,如果形式是invali或瓦利?结果
按钮是表单的结果
THX
how can i disable and enable button if form is invali or vali ?
the button is out of the form
Thx
推荐答案
您可以访问它的名字形成,这个对象将有很多内置的值(见文档)的:的 https://docs.angularjs.org/api/ng/directive/form
You can access to form by it's name, and this object will have a lot of build-in values(see docs): https://docs.angularjs.org/api/ng/directive/form
和 NG-停用
是为指令,那么,禁用:
And ng-disabled
is directive for, well, disabling:
<input ng-disabled="frm.$invalid" type="button" value="ذخیره" class="btn btn-primary" ng-click="$broadcast('Save')" />
这篇关于如何禁用角外部按钮时,表格无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文