Skip to content

Instantly share code, notes, and snippets.

@bholzer
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bholzer/1b21106ec77d07d532a3 to your computer and use it in GitHub Desktop.
Save bholzer/1b21106ec77d07d532a3 to your computer and use it in GitHub Desktop.
$files.forEach(function ($file) {
console.log('Should request'); //This runs as many times as there are images
var filePromise = $http.post('/api/images/upload').then(function (aws){ //This request runs only once
console.log(aws) //This also runs as many times as there are images, but aws is same EVERY TIME.
//Go on to upload file to S3
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment