var module = angular.module('commafeed.directives', []); module.directive('category', function($compile) { return { scope: { node: '=', selectedType: '=', selectedId: '=', feedClick: '&', categoryClick: '&', formatCategoryName: '&' }, restrict : 'E', replace: true, templateUrl: 'directives/category.html', link: function(scope, element) { if (scope.node.children) { var ul = element.find('ul'); ul.prepend(''); $compile(ul.contents())(scope); } } }; });