I have a group of buttons:
<div class="btn-group">
<button class="btn btn-primary" ng-click="filter_emails()"><span class="ion-home mr-2"></span>All</button>
<button class="btn btn-outline-primary" ng-click="filter_emails('new')"><span class="ion-plus-circled mr-2"></span>New</button>
<button class="btn btn-outline-primary" ng-click="filter_emails('inbox')"><span class="ion-archive mr-2"></span>Inbox</button>
<button class="btn btn-outline-primary" ng-click="filter_emails('shielded')"><span class="ion-paper-airplane align-middle mr-2"></span>Shielded</button>
</div>
and an ng-click function as this:
$scope.filter_emails = function(category) {
if (category === "inbox") {
$scope.grouped = group(inbox($scope.emails));
} else if (category === "shielded") {
$scope.grouped = group(shield($scope.emails));
} else if (category === "new") {
$scope.grouped = group(is_new($scope.emails));
} else {
$scope.grouped = group($scope.emails);
}
}
The desired behavior I am trying to achieve is to add 'btn-primary' / remove 'btn-outline-primary' on the button clicked and add 'btn-outline' / remove 'btn-primary' from the previously selected button.
I am pretty brand new to angularjs so I am not sure how to do this and I want to resist augmenting anything with jQuery :)