From 3bd950075567d6821e3147dceea31d3705fe81e2 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Wed, 21 May 2014 18:44:11 -0700 Subject: [PATCH] CRM-14725 - Add Angular service wrapper for CRM.api3 --- templates/CRM/Core/Page/Angular.tpl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/CRM/Core/Page/Angular.tpl b/templates/CRM/Core/Page/Angular.tpl index ca531b944d..1ff32b35d9 100644 --- a/templates/CRM/Core/Page/Angular.tpl +++ b/templates/CRM/Core/Page/Angular.tpl @@ -13,6 +13,12 @@ }); } ]); + crmApp.factory('crmApi', function(){ + return function(entity, action, params, message) { + // JSON serialization in CRM.api3 is not aware of Angular metadata like $$hash + return CRM.api3(entity, action, eval('('+angular.toJson(params)+')'), message); + }; + }); })(); -- 2.25.1