[英]Angular js bootstrap button disable
I have the following angularjs app html file: 我有以下angularjs app html文件:
<button class="btn btn-default pull-right" ng-click="open(subcategory)">Add Course <span class="glyphicon glyphicon-plus"></span></button>
I would like to know if we can disable the Add course
button whenever the condition required credits == completed credits
is met. 我想知道我们是否可以在条件required credits == completed credits
时禁用“ Add course
按钮。 The controller is a regular json file with all the parameters in the subcategories. 控制器是一个常规的json文件,包含子类别中的所有参数。
Please help! 请帮忙!
使用ng-disabled指令
<button class="btn btn-default pull-right" ng-disabled="subcategory.required2 == subcategory.completed2" ng-click="open(subcategory)">Add Course <span class="glyphicon glyphicon-plus"></span></button>
只需根据条件在控制器中设置isDisabled变量即可。
<button disabled="{{isDisabled}}">Disabled</button>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.