I am facing an issue with setting the icon style based on a value returned from the controller. The console log confirms that the value is triggered correctly, but it appears that there is a problem with the Ng-class expression. Any assistance on this matter would be greatly appreciated. Thank you in advance.
Controller Code
$scope.class = "favorite_border";
$scope.changeClass = function(){
if ($scope.class === "favorite_border")
$scope.class = "favorite";
else
$scope.class = "favorite_border";
console.log($scope.class);
}
View Code
<i ion-ripple ion-ripple-color="#ff0000"class="material-icons" style="font-size: 32px" ng-click="changeClass()" ng-class="'{{class}}'== favorite_border ? 'favorite_border' : 'favorite'"> {{class}}</i>
CSS Style
.favorite_border{ color:gray};.favorite{color:red};