I'm having trouble modifying a class I've created based on a value from JSON, and then changing it when the user clicks on it.
Here's my code in the controller:
$scope.like = function(){
if ($scope.class === "ion-ios-heart-outline")
$scope.class = "ion-heart";
else
$scope.class = "ion-ios-heart-outline";
};
And here's the element in the view:
<i ng-click="like()" ng-class="{ 'ion-heart' : article.like == 1, 'ion-ios-heart-outline' : article.like == 0}">