ng-repeat工作错误的AngularJS

时间:2016-12-28 10:27:31

标签: javascript angularjs ng-repeat

从服务器获取一个数组:

enter image description here

需要显示:这样的信息

<div class="object1">
<div class="content"></div>
<div class="content"></div>
<div class="content"></div>
</div>


<div class="object2">
<div class="content"></div>
<div class="content"></div>
</div>

现在它的工作原理如下:

<div class="object1">
    <div class="content"></div>
 </div>
<div class="object1">
    <div class="content"></div>
 </div>
<div class="object2">
    <div class="content"></div>
 </div>
<div class="object2">
    <div class="content"></div>
 </div>

我的ng-repeat:

<div class="feedback-container">
    <div ng-repeat="feedback in datasfeed | filter:keyword.classname " >
        {{feedback.id}}
        <div  ng-repeat="content in feedback.content" class="feedback-row gt-clear group group-content" >
        <div class="gt-left">
            <div class="ava-round-small"><img src="{{content.user_avatar}}"></div>
        </div>

        </div>
    </div>

</div>

那么如何改变它将被设置的代码我需要什么?

1 个答案:

答案 0 :(得分:2)

我会这样做

  <div class="feedback-container">
    <div ng-repeat-start="feedback in datasfeed | filter:keyword.classname " >
        {{feedback.id}}  
    </div>
    <div ng-repeat-end ng-repeat="content in feedback.content" class="feedback-row gt-clear group group-content" >
        <div class="gt-left">
            <div class="ava-round-small"><img src="{{content.user_avatar}}"></div>
        </div>
    </div>
</div>