For some quick background, uploadStoredFiles() is a method used in the FineUploader plugin to asynchronously send attached file data to a server path. I'm also using AngularJS for my application. My question is actually very similar to the one found here...
jQuery: wait for function to complete to continue processing?
... the big difference is that I don't have access to the callback function itself. Also, my script is running FineUploader as part of a larger form where attachments are optional, so using a FineUploader 'completed' callback won't help much either.
Here's a code sample. Basically, if there are no attachments then the page should reload. If there are attachments, they should be uploaded, and THEN the page should reload.
if(hasAttachments)
{
myuploader.uploadStoredFiles();
}
//AngularJS call to refresh page
$route.reload();
Most of the time, the page refreshes itself and the file is missing from its list until I do an additional refresh later on. I could hard code a wait time, but something about that seems inefficient and evil.
Any suggestions or solutions would be welcome. I would especially love an Angular-ish solution, but I'll take what I can get.