- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我在 Controller 中有一个条件。如果条件返回 true,那么我必须禁用所有链接和 ng-click
s
我们如何做:-
Controller : $scope.disableActions = true;
在 HTML 中
<button type="button" ng-click="ignoreAndRedisplay()" ng-disabled="disableActions">OpenClick</button>
所以通过这样做我必须到处写 ng-disabled="disableActions"
,这将是多余的,我们如何改进 n
个按钮和链接?
最佳答案
对于这种情况,我建议您做的是,将所有按钮放在单个 fieldset
中,然后在该 fieldset 上应用
,如果 ng-disabled
ng-disabled
表达式被评估为 true
disabled >
<fieldset ng-disabled="disableActions">
<button type="button" ng-click="ignoreAndRedisplay()">OpenClick</button>
<button type="button" >Some Other button</button>
<button type="button" >One more button</button>
...
</fieldset>
正如您在评论中要求禁用 anchor
标签一样。基本上你不能禁用 anchor
标签。您可以尝试以下 hack 以使其正常工作。
fieldset[disabled] a {
pointer-events: none;
}
关于javascript - Angular Js :Conditionally how to disable all button and links?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43654970/
我遇到过这个 html: 上面的html和这个有什么区别: 最佳答案 来自MDN page on the tag : 对于 type 的属性标签,可能的值是: 提交:按钮将表单数据提交给服务器
Button button= (Button) findViewbyID(R.id.button); 和 Button button = new Button(this); 有什么区别? 最佳答案 有
我是一名优秀的程序员,十分优秀!