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

26 lines
902 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: '&',
2013-03-22 07:31:15 +01:00
formatCategoryName: '&',
formatFeedName: '&'
2013-03-21 16:22:58 +01:00
},
restrict : 'E',
replace: true,
templateUrl: 'directives/category.html',
link: function(scope, element) {
2013-03-22 22:11:40 +01:00
var ul = element.find('ul');
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})" format-feed-name="formatFeedName({feed:feed})">\
</category>');
$compile(ul.contents())(scope);
2013-03-21 16:22:58 +01:00
}
};
});