Files
commafeed/src/main/webapp/js/directives.js

24 lines
847 B
JavaScript
Raw Normal View History

2013-03-21 16:22:58 +01:00
var module = angular.module('commafeed.directives', []);
module.directive('category', function($compile) {
return {
scope: {
node: '=',
selectedType: '=',
selectedId: '=',
feedClick: '&',
2013-03-21 23:10:05 +01:00
categoryClick: '&',
formatCategoryName: '&'
2013-03-21 16:22:58 +01:00
},
restrict : 'E',
replace: true,
templateUrl: 'directives/category.html',
link: function(scope, element) {
if (scope.node.children) {
var ul = element.find('ul');
2013-03-21 23:10:05 +01:00
ul.prepend('<category ng-repeat="child in node.children" node="child" feed-click="feedClick({id:id})" category-click="categoryClick({id:id})" selected-type="selectedType" selected-id="selectedId" format-category-name="formatCategoryName({category:category})"></category>');
2013-03-21 16:22:58 +01:00
$compile(ul.contents())(scope);
}
}
};
});