Why ng-class don't work with scope var's
sheikContolls.controller('MainPageController', ['$scope', 'authService',
function ($scope, authService) {
if(!authService.isAuthenticated()){
$scope.class1 = "good";
}
else {
$scope.class1= "bad";
}
}
]);
HTML:
<div class="demo" ng-class="class1"></div>
When you first start the class is added and we have class="demo good", but if then isAuthenticated() return true, class don't change, why ?? The same with next HTML:
<div class="demo {{class1}}"></div>
If i make a function - all work perfect.
<div class="demo" ng-class="getClass()"></div>