编程语言
首页 > 编程语言> > javascript – ng-repeat工作错误的AngularJS

javascript – ng-repeat工作错误的AngularJS

作者:互联网

从服务器获取一个数组,如下所示:

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>

我的重复:

<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>

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

解决方法:

我会那样做的

  <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>

标签:javascript,angularjs,ng-repeat
来源: https://codeday.me/bug/20190701/1351644.html