1
I have the following method:
$scope.upload = function (files) {
if (files && files.length) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
if (!file.$error) {
Upload.upload({
url: '/CreCpa/getExtrato',
data: {
// tela: "tarefa",
//registro: $scope.registro2.t0060_id_tarefa,
file: file
}
}).then(function (resp) {
//$timeout(function () {
// $scope.log = 'arquivo: ' +
// resp.config.data.file.name +
// ', resultado: ' + JSON.stringify(resp.data) +
// '\n' + $scope.log;
//});
}, null, function (evt) {
//var progressPercentage = parseInt(100.0 *
// evt.loaded / evt.total);
//$scope.log = 'progress: ' + progressPercentage +
// '% ' + evt.config.data.file.name + '\n' +
// $scope.log;
})
}
}
}
};
this method works normally, and returns a json, my doubt is how to take the data of the json and put in a variable, since q do not know in which "variable" is being returned that json.
I tried to put a . Success;
$scope.upload = function (files) {
if (files && files.length) {
for (var i = 0; i < files.length; i++) {
var file = files[i];
if (!file.$error) {
Upload.upload({
url: '/CreCpa/getExtrato',
data: {
// tela: "tarefa",
//registro: $scope.registro2.t0060_id_tarefa,
file: file
}
}).then(function (resp) {
//$timeout(function () {
// $scope.log = 'arquivo: ' +
// resp.config.data.file.name +
// ', resultado: ' + JSON.stringify(resp.data) +
// '\n' + $scope.log;
//});
}, null, function (evt) {
//var progressPercentage = parseInt(100.0 *
// evt.loaded / evt.total);
//$scope.log = 'progress: ' + progressPercentage +
// '% ' + evt.config.data.file.name + '\n' +
// $scope.log;
}).success(function (data) {
$scope.transactions = data;
});
}
}
}
};
Dude, put it on . then right...
– Sorack
Upload
is a variable that references angular http? The error message is very clear, there is no methodthen..success
.– BrTkCa
Solved your doubt?
– durtto