Skip to content

Instantly share code, notes, and snippets.

@jergason
Created April 6, 2015 15:49
Show Gist options
  • Save jergason/ec9145d854fdd8924818 to your computer and use it in GitHub Desktop.
Save jergason/ec9145d854fdd8924818 to your computer and use it in GitHub Desktop.
// this totally won't work b/c I didn't test it, but something like this
function getAllShips(url) {
var ships = [];
function getMoreShips(url) {
return $http.get(url).then(function(response) {
ships = ships.concat(response.ships)
if (response.has_more_url) {
return getMoreShips(response.has_more_url)
}
else {
return ships
}
})
}
return getMoreShips(url)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment