Please help me to change the class of input[type=button] dynamically using angularjs and controller.
app.controller('anodekeypadcntrl',function($scope){
$scope.clickTwentyFour = function(event){
In this function I need to highlight the button (adding the .active class to it)
};
});
<div class="keypadcontainer" ng-controller="anodekeypadcntrl as child">
------
<input type="button" value="24" id="twentyFour" class="twentyfour anodeKeypadButton"
ng-click="clickTwentyFour($event)" />
-------------
</div>
You can use ng-class
to dynamically add class to your div
or button or whatever
Here is a working plunker with your code
http://embed.plnkr.co/rzS8GV975BHRk83xhsPx/preview
Hope this helps
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With