Juri Strumpflohner
Juri Strumpflohner Juri is a full stack developer and tech lead with a special passion for the web and frontend development. He creates online videos for Egghead.io, writes articles on his blog and for tech magazines, speaks at conferences and holds training workshops. Juri is also a recognized Google Developer Expert in Web Technologies

$q.defer: You're doing it wrong

1 min read

Nice article on Angular deferreds, promises and things you may do wrong.

  • use $q.when(['detail', 'simple']) for simple defereds
  • use promise chaining whenever possible, like return $http....
  • $timeout already returns a promise, so return $timeout
  • use custom made deferreds when wrapping traditional callback APIs (like many of jQuerys)
  • use return $q(function(resolve, reject){ ... }) directly (Angular 1.3+ only)

Questions? Thoughts? Hit me up on Twitter
comments powered by Disqus