I am attempting to block navigation and display a popup in a controller.
$rootScope.$on('$stateChangeStart', function(event, toState, toParams, fromState, fromParams) {
if(someConditionMet) {
event.preventDefault();
showPopup();
}
}
Everything is functioning perfectly except for tab navigation. The prevention of navigation does not work properly as it goes to the tab first and then displays the popup. Additionally, when the scope changes, the popup fails to load correctly and triggers an exception. I end up with a blank popup with no way to close it.
Edit - Check out this Plunker demo http://plnkr.co/edit/r8MxO6tDZfTlHPXrVJlM?p=preview
When you click on About from the side menu, the prevention works smoothly. But when you click on the settings tab, it tries to navigate to the tab first before showing the popup. Also, the settings tab fails to load successfully.