Running a function everytime the $state changes
.run(function($rootScope, cleanModals) { $rootScope.$on('$stateChangeSuccess', function() { cleanModals.clean(); }); })