Reputation: 2669
I've got the following code that works fine on android, chrome on the iphone and in safari on the desktop, however it doesn't work on an iphone. The page never changes, i used alerts to determin it all works up till the $location.path part.
.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');
}
From reading online I also tried:
$location.path('/index');
$scope.apply();
and
$timeout(function() {
$location.path('/index');
})
and
$scope.$apply(function() {
$location.path('/index');
});
with no luck. The final one broke chrome saying digest already running.
Upvotes: 0
Views: 259
Reputation: 2450
Change your $location.path to this:
location.hash = "index";
Sometimes hash will failed in my app. Already try to debug in angular source. Still don't know why.
Anyway, hope this will work for you.
Upvotes: 1