recently, the development project encountered a problem, that is, the angulajs did not jump $state.go after the page refresh. The code is as follows
<a href="" ng-bind="username" style="position:relative;"></a>
<a href="" ng-click="logout()" style="position:relative;"><span ng-if="!noUser"></span><span ng-if="noUser"></span> </a>
js:
$scope.logout = function () {
$scope.username="";
$scope.password="";
delete $localStorage.username;
delete $localStorage.password;
$state.go("loginNew");
};
routing:
.config (function ($stateProvider) {
$stateProvider
.state("login", {
url: "/login",
abstract:true,
templateUrl: "app/main/account/loginNew.html"
})
.state("loginNew", {
url: "/loginNew",
templateUrl: "app/main/account/login.html"
})
})
after logging in, the logout method can be used normally, and the click will jump directly to the landing page, but when the page is refreshed, when you click to exit for the first time, you only delete the cache and do not jump to the landing page. When you click again, you jump to the landing page. I hope God can point out what the problem is and how to solve it.