You can listen to the '$stateChangeStart' event and call event.preventDefault() to prevent the user from actually going to a new view.
$rootScope.$on('$stateChangeStart',
function(event, toState, toParams, fromState, fromParams){
event.preventDefault();
// transitionTo() promise will be rejected with
// a 'transition prevented' error
});
Note, if you are adding this listener inside your controller, you should keep a reference to the deregistration function in order to remove the listener when your scope is destroyed.
var removeListenerFn = $rootScope.$on('$stateChangeStart',
function(event, toState, toParams, fromState, fromParams){
event.preventDefault();
// transitionTo() promise will be rejected with
// a 'transition prevented' error
}
);
$scope.$on('$destroy',function(){
removeListenerFn();
});
Here is a sample Plunker which you can use to test it out: http://plnkr.co/edit/lYfkPuePGv1GlN1sFjW4?p=preview