user801116
user801116

Reputation:

How to disable a image button with custom disabled button image?

I am trying to create a button in angularjs with a img tag where it's image changes to disabled state using css. I am using2 class 1 for enabled other for disabled.

<button class="save-button" ng-disabled="{{isEnabled}}"></button>

Please help my plunker for the problem

Upvotes: 1

Views: 2348

Answers (1)

Nitsan Baleli
Nitsan Baleli

Reputation: 5458

when using ng-disabled, the expression should be a true/false value to determine if the button is actually disabled.

The code shoud look like this:

<button class="save-button" ng-disabled="!isEnabled" ng-click="test()"></button>
<button title="Toggle" ng-click="isEnabled = !isEnabled">toggle</button>

Now the button is disabled when the 'isEnabled' value is set to false.

I fixed your plnkr

Upvotes: 1

Related Questions