Last active
August 29, 2015 14:08
-
-
Save rcolepeterson/457519a610bdb471cf1b to your computer and use it in GitHub Desktop.
Angular - mock resolve
This file contains hidden or 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
//used for stubbing out a service and returning resolve | |
function getImagesService() { | |
var serviceUrl = ''; | |
//add fake data for testing. | |
if (serviceUrl === '') { | |
var images = [], image; | |
for (var i = 1; i <= 18; i++) { | |
var image = { | |
caption: "Lets party", | |
fullname: "cole peterson", | |
image_standard: "http://fillmurray.com/500/300", | |
image_thumbnail: "http://fillmurray.com/100/100", | |
username: "cole" + i | |
} | |
images.push(image); | |
} | |
var dfd = $q.defer(); | |
//Mock resolve. | |
dfd.resolve({ | |
status: 'ok', | |
data: images | |
}); | |
return dfd.promise; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment