Common.js - whitespace fixes
[civicrm-core.git] / js / angular-crmApp.js
index 95b896a512a6e94df9913f04916ecf9aa88d4b04..0726a045040cd0221783c60dc431a9fea3089462 100644 (file)
@@ -1,4 +1,7 @@
 (function(angular, CRM) {
+  // crmApp is the default application which aggregates all known modules.
+  // crmApp should not provide any significant services, and no other
+  // modules should depend on it.
   var crmApp = angular.module('crmApp', CRM.angular.modules);
   crmApp.config(['$routeProvider',
     function($routeProvider) {
@@ -7,41 +10,4 @@
       });
     }
   ]);
-  crmApp.factory('crmApi', function($q) {
-    return function(entity, action, params, message) {
-      // JSON serialization in CRM.api3 is not aware of Angular metadata like $$hash, so use angular.toJson()
-      var deferred = $q.defer();
-      var p;
-      if (_.isObject(entity)) {
-        p = CRM.api3(eval('('+angular.toJson(entity)+')'), message);
-      } else {
-        p = CRM.api3(entity, action, eval('('+angular.toJson(params)+')'), message);
-      }
-      // CRM.api3 returns a promise, but the promise doesn't really represent errors as errors, so we
-      // convert them
-      p.then(
-        function(result) {
-          if (result.is_error) {
-            deferred.reject(result);
-          } else {
-            deferred.resolve(result);
-          }
-        },
-        function(error) {
-          deferred.reject(error);
-        }
-      );
-      return deferred.promise;
-    };
-  });
-  crmApp.factory('crmLegacy', function() {
-    return CRM;
-  });
-  crmApp.factory('crmNavigator', ['$window', function($window) {
-    return {
-      redirect: function(path) {
-        $window.location.href = path;
-      }
-    };
-  }]);
 })(angular, CRM);