我已经获得了以下代码,可以在Android上正常工作,在iPhone上使用chrome,在桌面上使用Safari,但是它不能在iphone上运行。页面永远不会改变,我使用警报确定它一直工作到$ location.path部分。
.success(function(data, status, headers, config) {
stopLoading();
console.log(data);
if (data.Resp.startsWith("E")) {
alert(checkErrorCodes(data.Resp));
} else if (data.Resp === "OK") {
localStorage.setItem("SessionKey", data.SessionKey);
localStorage.setItem("Username", $scope.loginUsername);
$scope.username = localStorage.getItem('Username');
$location.path('/index');
}
通过在线阅读,我也尝试过:
$location.path('/index');
$scope.apply();
和
$timeout(function() {
$location.path('/index');
})
和
$scope.$apply(function() {
$location.path('/index');
});
没有运气。最后一个打破了镀铬说已经运行的摘要。
答案 0 :(得分:1)
将$ location.path更改为:
location.hash = "index";
有时哈希会在我的应用中失败。已经尝试在角度源中进行调试。还是不知道为什么。
无论如何,希望这对你有用。