Open sidebar
module.directive('collection', function () { return { restrict: "E", replace: true, scope: { collection: '=' }, template: "<ul><member ng-repeat='member in collection' member='member'></member></ul>" } }); module.directive('member', function ($compile) { return { restrict: "E", replace: true, scope: { member: '=' }, template: '<li>{{member.title}}</li>', link: function (scope, element, attrs) { if (angular.isArray(scope.member.children)) { $compile('<collection collection="member.children"></collection>')(scope, function(cloned, scope){ element.append(cloned); }); } }, } });
Close sidebar
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting
Back
Please note that all pasted data is publicly available.
X (fomerly Twitter)
GitHub
Use setting