crmStatus - Fix for use without a promise.
authorTim Otten <totten@civicrm.org>
Sat, 24 Jan 2015 00:18:36 +0000 (16:18 -0800)
committerTim Otten <totten@civicrm.org>
Sat, 24 Jan 2015 02:46:43 +0000 (18:46 -0800)
js/angular-crm-util.js

index b889346dcfd0e4cbee68d33be71a29c03965b5b0..62437f558f1714290f48969c18a6252066ba32bc 100644 (file)
   // example: crmStatus('Saving', crmApi(...)).then(function(result){...})
   angular.module('crmUtil').factory('crmStatus', function($q){
     return function(options, aPromise){
-      return CRM.toAPromise($q, CRM.status(options, CRM.toJqPromise(aPromise)));
+      if (aPromise) {
+        return CRM.toAPromise($q, CRM.status(options, CRM.toJqPromise(aPromise)));
+      } else {
+        return CRM.toAPromise($q, CRM.status(options));
+      }
     };
   });