2014-11-03 64 views
0

我已经得到了以下代码,可以在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'); 
       }); 

没有运气。最后一个打破铬说消化已经运行。

回答

1

更改$ location.path这样:

location.hash = "index"; 

有时哈希会失败在我的应用程序。已经尝试在角度源中进行调试。仍然不知道为什么。

无论如何,希望这会为你工作。