<a class="btn pull-right"
ng-class="{true: 'btn-primary', false: 'btn-danger'}[!patient.archived]"
ng-click="patient.archived = !patient.archived">
{{!patient.archived && 'Archive' || 'Unarchive'}} patient
</a>
$scope.toggleButton = { inAddState: true };
$scope.update = (id, button) => {
if (button.inAddState) {
// logic to add
} else {
// logic to remove
}
// make sure you switch the state of the button at some point
button.inAddState = !button.inAddState;
}
<button ng-click="update(data.id, toggleButton)"
class="btn {{ toggleButton.inAddState ? 'btn-primary' : 'btn-warning' }}"
ng-bind="toggleButton.inAddState ? 'Add' : 'Remove'">
</button>