首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Angular2,如果未选中复选框,则禁用按钮

Angular2,如果未选中复选框,则禁用按钮
EN

Stack Overflow用户
提问于 2015-12-08 02:44:10
回答 1查看 75.1K关注 0票数 21

我有多个复选框和一个按钮,只有在至少选中一个复选框时才必须启用该按钮

代码语言:javascript
复制
<input type="checkbox">VALUE1
<input type="checkbox">VALUE2
<input type="checkbox">VALUE3
<input type="checkbox">VALUE4
<button>Proceed</button>

这是如何使用Angular2实现的。

附言:发现了类似的问题,但没有使用Angular2。

EN

回答 1

Stack Overflow用户

发布于 2015-12-08 02:55:32

使用属性disable as:

代码语言:javascript
复制
<input type="checkbox" [(ng-model)]="disableButton1"> VALUE1
<input type="checkbox" [(ng-model)]="disableButton2"> VALUE1
<input type="checkbox" [(ng-model)]="disableButton3"> VALUE1
<input type="checkbox" [(ng-model)]="disableButton4"> VALUE1
<button type="button" [disabled]="disableButton || disableButton2">Submit</button>
票数 9
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34140847

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档