*I am using this code in my controller, inserting this controller dependency is breaking the whole code. *

    $state.get('shop').onExit = function(){
modalCtrl.openModal(modalViewUrl,null);
//calling a controller which has the functions to open $modal
//handle modal submitHandler
    }
1

There are 1 answers

0
amala On

1.this event will be invoked when user navigates away from the page:

$scope.$on('$locationChangeStart',function(event){
    //action to be performed
    event.preventDefault();
    $('#modalName').modal();
});