Support is_primary fields and boolean options.
[civicrm-core.git] / ext / afform / core / ang / afCore.js
1 (function(angular, $, _) {
2 // Declare a list of dependencies.
3 angular.module('afCore', CRM.angRequires('afCore'));
4
5 // Use `afCoreDirective(string name)` to generate an AngularJS directive.
6 angular.module('afCore').service('afCoreDirective', function($routeParams, crmApi4, crmStatus, crmUiAlert) {
7 return function(camelName, meta, d) {
8 d.restrict = 'AE';
9 d.scope = {};
10 d.scope.options = '=' + camelName;
11 d.link = {
12 pre: function($scope, $el, $attr) {
13 $scope.ts = CRM.ts(camelName);
14 $scope.routeParams = $routeParams;
15 $scope.meta = meta;
16 $scope.crmApi4 = crmApi4;
17 $scope.crmStatus = crmStatus;
18 $scope.crmUiAlert = crmUiAlert;
19 $scope.crmUrl = CRM.url;
20 }
21 };
22 return d;
23 };
24 });
25 })(angular, CRM.$, CRM._);