첫 번째 $ http.post 약속 (.then과 함께 사용하는 경우) 개체를 아무 문제없이 반환하지만 다른 $ http.post 약속을 중첩 할 때도 함께 사용됩니다. 그렇다면 객체를 반환 할 수 없습니다. 내가하는 일에 상관없이 항상 약속을 되풀이합니다. 이 같은
function getDocumentPages($http) {
var data = { fileName: '@fileNameUrlSafe' };
return $http.post(controllerBaseUrl + "GetDocumentPages", data)
.then(function successCallback(response) {
// =======================================
// THE LINE BELOW ALWAYS RETURNS A PROMISE
// =======================================
var fieldPages = getDocumentFormFields($http);
var tempModel = {
pages: response.data,
fieldPages: fieldPages
};
return tempModel;
}, function errorCallback(response) {
console.log(response);
});
}
function getDocumentFormFields($http) {
var data = { fileName: '@fileNameUrlSafe' }
return $http.post(controllerBaseUrl + "GetDocumentFormFields", data)
.then(function successCallback(response) {
return response.data;
}, function errorCallback(response) {
console.log(response);
});
}
콘솔에 오류가 있습니까? –
아니요 오류가 없습니다 – RichC