I'm using jQuery File Uploader through Angular.js. I need to pass the server's response from the image upload to the Angular $scope, but I can't access the $scope within the done
function:
function LandmarkNewCtrl($location, $scope, db) {
$('#fileupload').fileupload({
url: '/api/upload',
dataType: 'text',
done: function (e, data) {
$scope.landmark.avatar = data.result;
}
});
}
Getting "Uncaught TypeError: Cannot read property 'landmark' of undefined" errors.
How do I pass $scope into the done: function()
?