(function () { "use strict"; var name = 'adPageItem'; angular.module('app.directive') .directive('adPageItem', ['$document', '$compile', function ($document, $compile) { return { scope: { state: '=' + name }, link: function (scope, element, attributes) { var data = scope.state.data, node, content; node = angular.element($document[0].createElement(data.tag || 'div')).attr(data.attr); content = $compile(node)(scope); element.append(content); } }; }]); })();