Skip to content

Instantly share code, notes, and snippets.

@benfoxall
Created August 19, 2015 15:07
Show Gist options
  • Save benfoxall/0ba907ff7344e32ab3ca to your computer and use it in GitHub Desktop.
Save benfoxall/0ba907ff7344e32ab3ca to your computer and use it in GitHub Desktop.
function fake(obj, keys) {
angular.forEach(keys, function(property, key) {
$http.get('http://faker.hook.io?property=' + property)
.then(function(value) {
obj[key] = JSON.parse(value.data);
});
});
}
fake($scope.player, {
firstName: 'name.firstName',
lastName: 'name.lastName',
authEmail: 'internet.email'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment