If you are using AngularJS, the following code should do the trick. You must add this code to the app.js file or file, where you enter all your dependencies
var myApp = angular.module('myApp', ['ngMask', 'ngRoute', 'ngAnimate', 'ngSanitize', 'ngTouch', 'ngCookies', 'ngMessages', 'ui.router', 'ui.grid', 'ui.directives', 'ui.filters', 'ui.bootstrap', 'angularUtils.directives.dirPagination']); myApp.run(function($rootScope, $route, $location) { var allowNav = false; var checkNav = false; $rootScope.$on('$stateChangeSuccess', function (event, toState, toStateParams, fromState, fromStateParams) { allowNav = checkNav; checkNav = true; }); $rootScope.$on('$locationChangeStart', function (event, next, current) {
source share