Skip to content

Instantly share code, notes, and snippets.

@abruzzi
Created December 30, 2013 02:31
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 abruzzi/8177126 to your computer and use it in GitHub Desktop.
Save abruzzi/8177126 to your computer and use it in GitHub Desktop.
What does $q.when do?
Calling $q.when takes a promise or any other type, if it is not a promise then it will wrap it in a promise and call resolve. If you pass a value to it then it is never going to be rejected.
From the docs:
Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment