Sunday, March 19, 2017

the Promise API's way of doing things

function returnPromiseWhileStagingThenConditions(someVariable) {
   return globalService.getStuff(someVariable).then(yesGood, noBad);
   
   function yesGood() {
      otherGlobalThing.doSomething();
      return $q.when();
   }
   
   function noBad() {
      return $q.reject();
   }
}

No comments:

Post a Comment