【发布时间】:2015-12-01 08:12:09
【问题描述】:
我有一个控制器,它在作用域中添加了一个名为 comments 的变量
$scope.showComments = function(id){
dataService.getComments(id).then(function(data){
$scope.comments[id] = data.comments;
console.log($scope.comments);
});
}
我想在特定 id 上调用 ng-repeat。以下方法不起作用。有什么想法吗?
<div class="commentsContainer" id="{{id}}">
<div class="eachcomment" ng-repeat="comment in comments.{{id}}">
<p>{{comment.content}}
</div>
</div>
所需的 id 被赋予外部 div。但是ng-repeat 不起作用。
【问题讨论】:
标签: javascript angularjs dom