Files
commafeed/src/main/webapp/js/directives.js
Jeremie Panzer 0161de1f13 angular prototype
2013-03-21 16:59:50 +01:00

23 lines
754 B
JavaScript

var module = angular.module('commafeed.directives', []);
module.directive('category', function($compile) {
return {
scope: {
node: '=',
selectedType: '=',
selectedId: '=',
feedClick: '&',
categoryClick: '&'
},
restrict : 'E',
replace: true,
templateUrl: 'directives/category.html',
link: function(scope, element) {
if (scope.node.children) {
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"></category>');
$compile(ul.contents())(scope);
}
}
};
});