As far as I understand, the usual way to get a notification on a state change is to put a callback on the $stateChangeStart event, like in this answer.
However, if I understand correctly, I could also attach the $state object to the current scope, as in:
myApp.controller('myAppCtrl', function($scope, $state) {
$scope.$state = $state;
}
This, as far as I understand, would make it possible to watch state details directly from HTML templates, e.g. (assuming some of my states have a boolean flag .isAdminOnlyState set to true and I wanted to make the whole page red when displaying them):
<body ng-class='{"everythingInRed": $state.current.data.isAdminOnlyState}'>
What are advantages and disadvantages of this approach, as compared to having a listener function?