3 ms·
Nice looking app! You're not doing promises right however :) `$http.get()` etc returns a promise, so you can do all transforms and logic via `.then()`. The onl
by timruffles 12y ago
Nice looking app!
You're not doing promises right however :) `$http.get()` etc returns a promise, so you can do all transforms and logic via `.then()`. The only time you should ever use `$q.defer()` is when you're wrapping a non-promise API. The bluebird library has a nice write-up: https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns#the-deferred-anti-pattern https://github.com/petkaantonov/bluebird/wiki/Promise-anti-p...
- girvo 12y agoPromises are pretty great, too. I wrote some (now in production!) feature detection/facial recognition code using OpenCV through the node-opencv library, but as some of the big calls were async and I needed it to work in a somewhat synchronous way, I wrapped it all up in Q. Once you understand how they work, they can be quite great.
- Bahamut 12y agoThis is a really common mistake I have found with angular shops - almost none realize that all $http is is an augmented $q.when promise.