How to $watch state change of $stateProvider in AngularJS?

It's in the docs: https://github.com/angular-ui/ui-router/wiki#state-change-events

$rootScope.$on('$stateChangeStart', 
function(event, toState, toParams, fromState, fromParams){ 
    // do something
})

This works:

$scope.$watch(function(){
    return $state.$current.name
}, function(newVal, oldVal){
    //do something with values
})