UNPKG

zettapi_client

Version:

Admin panel and client-side CRUD operations in angular to use with zettapi_server rest api to get started quickly in any CMS project.

20 lines (17 loc) 612 B
app.directive('ngAttr', function ($parse) { return { restrict: 'A', link: function (scope, element, attrs) { var el = element[0]; scope.$watch(attrs.ngAttr, setAttributes, true); function setAttributes() { var attrsAndValueRefs = $parse(attrs.ngAttr)(scope) || {}; Object.keys(attrsAndValueRefs).filter(function (attr) { return typeof attrsAndValueRefs[attr] === 'string' && attrsAndValueRefs[attr] !== el.getAttribute(attr); }).forEach(function (attr) { el.setAttribute(attr, attrsAndValueRefs[attr]); }); } } }; });