我对Angularjs相对较新,我试图找出最合适的删除指针事件的方法,因为ng-disable仍然允许点击事件。这是我没有成功的事情:
HTML
<img class="btn btn-primary" style="border: none; margin-top: 0px;"
src="assets/img/test-22x22.png"
ng-class="path !== '/begin' && path !== '/end'?{'pointer-events': 'none'}:{}">
答案 0 :(得分:1)
您可以在代码中使用ng-style:
<img class="btn btn-primary" style="border: none; margin-top: 0px;"
src="assets/img/test-22x22.png"
ng-style="path !== '/begin' && path !== '/end'?{'pointer-events': 'none'}:{}">
或者添加带有某些值的类并使用它
.no-pointer-class {
cursor: not-allowed;
pointer-events:none;
}
<img class="btn btn-primary"
style="border: none; margin-top: 0px;"
src="assets/img/test-22x22.png"
ng-class="{'no-pointer-class': (path !== '/begin' && path !== '/end')}">
答案 1 :(得分:0)
您可以将img元素**<img style="cursor:not-allowed;">**
的css样式设置为光标不允许的