2014-11-03 66 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"; 

有時哈希會失敗在我的應用程序。已經嘗試在角度源中進行調試。仍然不知道爲什麼。

無論如何,希望這會爲你工作。