내가 이중 HTTP의 제 요구가 먼저 인증 요청을 만들고 싶어 진정한 다음 문을 실행하는 경우 (즉, 단지 $를 돌려 보내는 코드 조각을 호출 http 약속). angularJS에서 어떻게해야합니까? 현재로서는 정의되지 않은 상태로 돌아갑니다.
dmdb._login_request = function(credentials, conf) {
var p = {
'_method': 'POST',
'data[User][username]': credentials.login,
'data[User][password]': credentials.password
};
conf.headers = {
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
};
var userData = {
'username': 'mbah',
'password': '[email protected]',
'applicationid': '1'
};
$http.post('myapp.com/authenticate/', userData, con).success(function(data) {
if (data.success) {
return $http.post(this.url + 'users/login', $.param(p), conf);
}
return $q.when('failed');
})
};
복사 이미지를 제공의 코드를 대신하여 붙여 넣으세요 – Houseman
@Houseman 방금했습니다. 제발 어떤 제안이나 조언을 부탁드립니다. – mass