2013-06-05 2 views

답변

1
난 그냥 하나의 지시어를 사용하는 것이 좋습니다 및 템플릿에 ng-repeat을 활용하는 것

:

app.directive('myDirective', function (objects) { 
    return { 
     link: function(scope,element,attrs){ 
      scope.objects = objects;  
     }, 
     template: '<ul><li ng-repeat="o in objects">{{o.name}}</li></ul>' 
    }; 
}); 

그러나 여전히 두 번째 지시어를 사용하려는 경우, 당신은 단지에 최초의 템플릿을 변경, 그대로 사용할 수 있습니다 :

'<ul><li ng-repeat="o in objects" other-directive object="o"></li></ul>' 

데모 :Here is a fiddle

+0

그것은 내가 링크 기능이었다 잘못 노래. 정말 고마워! –