I'd say use onExit hook of ui-router which you can specify on single state. But you can't access $scope inside it.

To deal with it, I'd say maintain service which will have shareable data. Change that shareable data from onExit hook of your desired state. Then you can access the same service inside your controller as well.