$q.defer: You're doing it wrong
Juri Strumpflohner
Published
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, soreturn $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)