(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
# to generate your dhparam.pem file, run in the terminal | |
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048 |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
success
/ error
are not promise flow. They're pseudopromise demons. Use then
and catch
instead.$q.defer
is satan. You should basically never use it. There is an alternative syntax that is superior, $q(function(resolve, reject) {})
but chances are that what you’re working with already returns a promise, and if it does there is absolutely no need for either of these.promiseFn().then(successFn, errorFn)
pattern, as errorFn will only catch errors caused by promiseFn, but not by successFn. Use then(successFn).catch(errorFn)
instead.
Also note that you can chain several thenables and catch all of them this way, ala then(a).then(b).then(c).catch(errorFn)
, in which errorFn will handle errors that happen for any of a, b, or c.return
from a then-able is turned into a resolving promise. Whatever you throw
is turned into a rejecting one. For instance, `.catch