// 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"); $.post(doGetPath('/logoutJsonController.json'), { ajax: true, dataType: 'json', type: "POST" }); $templateCache.removeAll(); $location.url('login').replace(); // $window.location.href = ""; $scope.$apply(); // try { // var jsLogout = $.post(doGetPath('/logoutJsonController.json'), // { // ajax: true, // dataType: 'json', // type: "POST" // }); // jsLogout.success( // function () { // alert("force logout success"); // $templateCache.removeAll(); // //alert($window.location.href); // $window.location.href = "index.jsp"; // //$location.path("/"); // //$location.path("/login"); // $scope.$apply(); // } // ).error( // function () { // alert("force logout Error"); // $templateCache.removeAll(); // $window.location.href = "index.jsp"; // //$location.path("/"); // //$location.path("/login"); // $scope.$apply(); // } // ); // } // catch (e) { // alert("force logout catch"); // $templateCache.removeAll(); // //$window.location.href = "login.jsp"; // $window.location.href = "index.jsp"; // //$location.path("/"); // //$location.path("/login"); // $scope.$apply(); // // //$window.location.href = "login.jsp"; // } });