모두
나는 현재 작업중인 AngularJS PhoneGap 응용 프로그램을 가지고 있습니다. API 호출 응답을받은 직후에 발생하는 하나의 리디렉션에 멈추었습니다. 내 코드는 gist.github.com
에 있습니다. 내 문제는 then() 블록 내에서 리디렉션을 호출하는 controllers.js의 300 행에 있습니다.
UserService.login($scope.user.email, $scope.user.password)
.then(function(response) {
globals.session_id = response.data.meta.session_id;
globals.logged_in_userId = response.data.response.users[0].id;
if ($scope.user.remember === true) {
window.localStorage.setItem("_session_id", response.data.meta.session_id);
window.localStorage.setItem("logged_in_userId", response.data.response.users[0].id);
} else {
window.localStorage.removeItem("_session_id");
window.localStorage.removeItem("logged_in_userId");
}
})
.then(function() {
$location.path("/tab/locations");// <=== This line doesn't cause an error but does not result in a redirect
})
.
catch (function(response) {
alert(JSON.stringify(response));
});
누구든지 나를 도울 수 있다면, 고맙겠습니다!
덕분에, 브루스
지금까지 해봤 사용 rootScope 적용 B, 범위, 적용 및 범위 시계와 함께 약속 반환 내부 변수를 사용하고, 짧은 시간에 리디렉션 작업을 수행합니다. 나는 또한 window.navigation.href를 사용하여 시도했지만, 나는 아무것도 얻지 못한다. 성공적으로 로그인 한 후 사용자를 리디렉션 할 수있는 방법이 있어야합니다. – jaxmeier