AngularJS Ng-class Multiple Conditions With OR Operator
Answer : Try this. <a href="" ng-click="addFavorite(myfav.id);favorite=!favorite"> <i class="fa orange" ng-class="{'fa-star': favorite || fav==myfav.id, 'fa-star-o': !favorite}"></i> No need the brackets. Once you have to add some logic behind ng-class it's always better to stick to using the controller to do that. You can do it two of either ways: JSON syntax (same as in your HTML, just more readable) or obviously JavaScript. HTML (JSON) Syntax HTML <i ng-class="getFavClassIcon(myFav.id)"></i> JS $scope.getFavClassIcon= function (favId) { return { 'fa-star-o' : !$scope.favorite, 'fa-star' : $scope.favorite || $scope.fav === favId }; }; Good Old IF-statement (JavaScript) HTML <i ng-class="getFavClassIcon(myFav.id)"></i> JS $scope.getFavClassIcon= function (favId) { if (!$scope.favori...