Skip to content Skip to sidebar Skip to footer

Having One Button In Ng-repeat Change Color When Clicked, Not All Using Angularjs

Hi I'm trying to make my done button change green when clicked. The first time I attempted this, it changed all the buttons green. index.html

Solution 1:

<tbody>
        <tr ng-repeat="plan in scheduler.plans | orderBy:'standardTime'">
            <td class="plan-time">{{plan.displayTime}}</td>
            <td class="plan-duration">{{plan.duration}} minutes</td>
            <td class="plan-task">{{plan.task}}</td>
            <td><button type="button" ng-class="{'btn-primary': !plan.clicked, 'btn-success': plan.clicked}" ng-click="plan.clicked = !plan.clicked">Yes</button></td>
       </tr>
    </tbody>

Post a Comment for "Having One Button In Ng-repeat Change Color When Clicked, Not All Using Angularjs"