Skip to content

Instantly share code, notes, and snippets.

@HAKASHUN
Last active August 29, 2015 14:08
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 HAKASHUN/315eedba0f0a3fccd72d to your computer and use it in GitHub Desktop.
Save HAKASHUN/315eedba0f0a3fccd72d to your computer and use it in GitHub Desktop.
use spread with $q
function spread(func) {
return function(array) {
func.apply(void 0, array);
}
}
$q.all([getCurrentUser(), getPermissions()])
.then(spread(function(user, permissions) {
// Do something with user and permissions
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment