0

我已经使用 ng-disabled 禁用了一个元素,但是虽然我想禁用该按钮,但让它看起来好像它仍然处于启用状态。可能吗?

这就是我禁用按钮的方式-

<button class="button button-block button-assertive"  
        ng-click="disable()" 
        ng-disabled="isDisabled" 
        ng-model="isDisabled">
    <div style="text-align:center;">Register</div>
</button>
4

1 回答 1

0

如果您只想让它看起来好像仍然启用,您可以更改按钮的类,具体取决于 isDisabled 值:

<button class="button button-block button-assertive" ng-class="{'class-one' : isDisabled}" 
        ng-click="disable()" 
        ng-disabled="isDisabled" 
        ng-model="isDisabled">
    <div style="text-align:center;">Register</div>
</button>

这是关于 ng-class 的文档:

https://docs.angularjs.org/api/ng/directive/ngClass

于 2015-10-29T11:43:25.520 回答