Last active
August 29, 2015 14:08
-
-
Save HAKASHUN/315eedba0f0a3fccd72d to your computer and use it in GitHub Desktop.
use spread with $q
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
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