1
I’m using the angular file upload, it works very well, but I need the return that the server makes available to me. I am using the following code:
$scope.uploader = new FileUploader({
url: 'https://api.imgur.com/3/image',
alias: 'image',
headers: {
Authorization: 'Client-ID XXXXXXXXXXXXXXXXXXXX',
},
autoUpload: true,
});
The answer:
{"data":{"id":"sK1PnoE","title":null,"description":null,"datetime":1454191817,"type":"image\/png","animated":false,"width":400,"height":400,"size":8981,"views":0,"bandwidth":0,"vote":null,"favorite":false,"nsfw":null,"section":null,"account_url":null,"account_id":0,"comment_preview":null,"deletehash":"LLLGwJ7PdzYsord","name":"","link":"http:\/\/i.imgur.com\/sK1PnoE.png"},"success":true,"status":200}
Edited ---
I am unable to access the methods of Callbacks, tried in the following ways:
$scope.uploader.onCompleteItem = function(fileItem, response, status,headers) {
console.log(response);
};
$scope.uploader = new FileUploader({
//xxxxx
}).onSuccessItem = function(fileItem, response, status,headers) {
console.log(response);
};
Update the post, take a look. Thank you for the answer!
– SCOFIELD
IO that the console shows @SCOFIELD ?? And what you need to get information from? Only the status whether it worked or not?
– celsomtrindade
It actually worked :v I was trying to access the $Cope method before setting it (Genius). Thanks for the help!
– SCOFIELD
Haha not so. = D
– celsomtrindade