Created
April 6, 2015 15:49
-
-
Save jergason/ec9145d854fdd8924818 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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