1 (function(angular
, $, _
) {
2 // Example usage: <af-form><af-entity name="Person" type="Contact" /> ... <fieldset af-fieldset="Person> ... </fieldset></af-form>
3 angular
.module('af').directive('afFieldset', function() {
6 require
: ['afFieldset', '?^^afForm'],
8 modelName
: '@afFieldset'
10 link: function($scope
, $el
, $attr
, ctrls
) {
12 self
.afFormCtrl
= ctrls
[1];
14 controller: function() {
18 this.getData = function() {
19 return ctrl
.afFormCtrl
? ctrl
.afFormCtrl
.getData(ctrl
.modelName
) : localData
;
21 this.getName = function() {
22 return this.modelName
;
24 this.getEntityType = function() {
25 return this.afFormCtrl
.getEntity(this.modelName
).type
;
27 this.getFieldData = function() {
28 var data
= ctrl
.getData();
30 data
.push({fields
: {}});
32 return data
[0].fields
;
37 })(angular
, CRM
.$, CRM
._
);