我有一个在同一页面上多次使用的指令。该文档告诉我以下代码:
<my-directive info="one"></my-directive>
<my-directive info="two"></my-directive>
.directive('myDirective', function() {
return {
restrict: 'E',
scope: {
itemInfo: '=info'
},
templateUrl: 'my_directive.html'
};
});
my_directive.html:
<div ng-repeat="item in itemInfo.items">
<div>{{item.name}}</div>
<div>{{item.value}}</div>
</div>
我无法让它工作,我怀疑它与如何在我的指令中指定范围并尝试将其应用于ng-repeat中有关。我错过了什么?