標籤按鈕已經分配了光標css。我想根據is_active值來覆蓋遊標css以禁用按鈕。 is_active可能具有0或1的值。以下是js/html的代碼,請讓我知道將光標css應用於按鈕的正確方法。如何在!important中使用ng-style?
$scope.ngStyleDisabled = function(status) {
if (status == 1) {
return {};
} else if (status == 0) {
return '{\'cursor\':\'not-allowed !important\',\'pointer-events\':\'none\'}';
}
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<button ng-style="{{ngStyleDisabled(item.is_active)}}">Action Button</button>
想你的代碼返回的結果作爲 <鈕納克式= 「{」 光標 「:」!不被允許重要 「」指針事件「:」無「}」>動作按鈕 – Nishant
這不是你想要的嗎? – muenchdo
此返回值不帶雙引號。 – Nishant