У меня есть это приложение, которое загружает файл на сервер с помощью $ cordovaFileTransfer, а затем отправляет данные о файле на тот же сервер. Файл передается штрафом. Затем данные отправляются на сервер, и сервер отвечает. Но ответ не возвращается к ответу на обещание. Зачем?Угловое обещание callback not firing
$scope.sendPost = function(data) {
//first upload a file then send more data about the file
$cordovaFileTransfer.upload('http://example.com', 'myfile.txt', options)
.then(function(result) {
var promise = MyFactory.sendFileData(data);
});
promise.then(function(response) {
//we never make it to here
});
}
и MyFactory:
service.sendFileData = function(data) {
return $http({
//bunch of parameters. This function works, data is sent to the server and a response received
}).then(function(response) {
//this is fired when the response is received from the server. All is good so far.
return.response.data
});
}
return service;
Я I только один видя непарные скобки повсюду в коде? –
спасибо @AbdoAdel ... добавил отсутствующие скобки. – lilbiscuit