Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Using angular interceptors in uploader request #434
if you use ngResource when you create your $resource handler (angular factory) you can overwrite some methods, even so create functions inject queries if am not mistaken, you can use $q, $http callbacks to do what you want too, im a bit new on interceptors but thats the way im doing it right now. Cheers.
I have problems with dropzone exactly because of this - my interceptor (that check for "expired session" errors and automatically tries to refresh the session and repeats the previously failed request, in this case, the file upload) doesn't act on the upload fail because dropzone (being a jquery plugin) uses native browser XMLHttpRequest, just like angular-file-upload does.
The $httpProvider.interceptors can only keep track of XMLHttpRequest instances wrapped by the $http service - hence while using new XMLHttpRequests (outside of angular) it won't be able to act on them.
I was wondering if uploading images through $http is technically impossible, or if this is just a major design flaw in this library...
Looks feature-full and promising though, thanks to all the contributors for Your hard work!