Reputation: 43
I am trying to get the blueimp file upload plugin to play nicely with my app, using angularjs. I am having one issue. My server returns json data upon a successful upload. The problem is I cannot retrieve this data, although I can find it in the console.
$scope.$on('fileuploadprocessdone', function(event, files){
console.log(files);
});
Console:
Object {disabled: false, create: null, dropZone: x.fn.x.init[1], pasteZone: x.fn.x.init[1], replaceFileInput: true…}
_progress: Object
_response: Object
jqXHR: Object
result: Object
textStatus: "success"
I am trying to get the "result" Object in the "_response" object:
$scope.$on('fileuploadprocessdone', function(event, files){
console.log(files._response);
console.log(files.response);
});
returns (console) :
Object {} //first console log
function () {
return this._response; //second console log
}
I can clearly see the data returned by the server in the first console.log(files). How can I accomplish this?
Thank you.
Upvotes: 3
Views: 1271
Reputation: 3466
You can now prevent default event actions in Angular scope listeners, too:
$scope.$on('fileuploaddone', function(e, data){
console.log(data.result);
});
Upvotes: 1