I need to dynamically set a class based on a boolean value that is determined in a service. This example is simplified for readability, but in reality, the boolean would be set by multiple functions within the service.
Here is how it would look in HTML:
<div ng-controller="MainController">
<div ng-class="{ 'green' : MainController.CustomService.isGreen }">
</div>
</div>
The service code would be like this:
App.service("CustomService", function() {
this.isGreen = true;
})
And the controller code would look something like this:
App.controller('MainController', ['$scope', 'CustomService', function($scope, CustomService) {
}]);