zettapi_client
Version:
Client side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project
19 lines (18 loc) • 618 B
JavaScript
app.directive('zlDynamicField', function (zapiPath) {
return {
restrict: 'E',
scope: {
field: '=',
value: '='
},
replace: false,
template: '<div ng-include src="contentUrl" include-replace></div>',
link: function (scope, element, attrs) {
var type = scope.field.type || 'Unknown';
if (scope.field.type === 'ObjectId' && typeof scope.field.ref === 'undefined') {
type = "String";
}
scope.contentUrl = zapiPath + "/directives/dynamicField/" + type + ".html";
}
};
});