Disable or enable button per item in angularjs -
i have list of participants. each participant have dial , mute buttons. want disable mute button @ first , enable after dial button clicked. currently, if click on dial button of participant 1, mute buttons of other participants enables. want enable mute button of participant 1.
html:
<body ng-controller="mainctrl"> <table> <tr ng-model="participant.partname" ng-repeat="participant in participants"> <td>{{participant.partname}}</td> <td> <button ng-click="mutepart(participant.partname);">mute</button> </td> <td> <button ng-click="dial(participant.partname)">dial</button> </td> </tr> </table> </body>
js:
$scope.participants = [ { partname: 'abc', partid: '123' }, { partname: 'def', partid: '1234' }, { partname: 'xyz', partid: '12345' }, ] $scope.mutepart = function(item){ } $scope.dial = function(item){ }
<body ng-controller="mainctrl"> <table> <tr ng-model="participant.partname" ng-repeat="participant in participants"> <td>{{participant.partname}}</td> <td> <button ng-disabled="!callsessions[$index]" ng-click="mutepart(participant.partname);">mute</button> </td> <td> <button ng-click="dial(participant.partname, $index)">dial</button> </td> </tr> </table> </body>
controller:
$scope.callsessions= {}; $scope.dial = function(name, index){ $scope.callsessions[index] = true; }
Comments
Post a Comment