Angularjs: highlight a button on click -
<tbody md-body> <tr md-row md-select="dessert" md-select-id="name" ng-model="participant.partname" md-auto-select ng-repeat="participant in participants track participant.partname | filter: search"> <td md-cell>{{participant.partname}}</td> <td md-cell><img src="./images/mute.png" ng-click="mutepart(participant.partname);" title="mute" ng-class="{'selected-image' : participant.partname === muteselected}" /></td> <td md-cell><img src="./images/unmute.png" ng-click="unmutepart(participant.partname);" title="unmute" ng-class="{'selected-image' : participant.partname === unmuteselected}"/></td> </tr> </tbody>
js:
$scope.mutepart = function(muteselected) { $scope.muteselected = muteselected; $scope.unmuteselected = null; $rootscope.muteind = true; $rootscope.muted = true; } $scope.unmutepart = function(unmuteselected) { $scope.unmuteselected = unmuteselected; $scope.muteselected = null; $rootscope.mutind = false; $rootscope.muted = false; }
css: .selected-image { border: 1px solid red; }
i have mute, unmute image buttons various endpoints. 1st endpoint, click on mute, gets selected if click on mute of 2nd endpoint selected mute of 1st endpoint not selected anymore. want keep clicked buttons of mute or unmute highlighted.. 1 button gets selected on click.
Comments
Post a Comment