// create the controller and inject Angular's $scope scotchApp.controller('logoutController', // create a message to display in our view function($scope ,$window ,$templateCache ,$location) { //alert("logoutController"); try { var jsLogout = $.post(doGetPath('/logoutJsonController.json'), { ajax: true, dataType: 'json', type: "POST" }); jsLogout.success( function(){ $templateCache.removeAll(); //alert($window.location.href); $window.location.href = "index.jsp"; //$location.path("/"); //$location.path("/login"); $scope.$apply(); } ).error( function(){ $templateCache.removeAll(); $window.location.href = "index.jsp"; //$location.path("/"); //$location.path("/login"); $scope.$apply(); } ); } catch (e) { $templateCache.removeAll(); //$window.location.href = "login.jsp"; $window.location.href = "index.jsp"; //$location.path("/"); //$location.path("/login"); $scope.$apply(); //$window.location.href = "login.jsp"; } });