Javascript 角度JS在无序列表中的2个数组中重复
我得到了这个html:Javascript 角度JS在无序列表中的2个数组中重复,javascript,arrays,angularjs,Javascript,Arrays,Angularjs,我得到了这个html: <ul class="demo-list-three mdl-list"> <li class="mdl-list__item mdl-list__item--three-line" ng-repeat="p in projects"> <span class="mdl-list__item-primary-content"> <i class="material-icons md
<ul class="demo-list-three mdl-list">
<li class="mdl-list__item mdl-list__item--three-line" ng-repeat="p in projects">
<span class="mdl-list__item-primary-content">
<i class="material-icons mdl-list__item-avatar">person</i>
<span>{{p}}</span>
<span class="mdl-list__item-text-body">
{{descriptions[0]}}
</span>
</span>
<span class="mdl-list__item-secondary-content">
<a class="mdl-list__item-secondary-action" href="#"><i class="material-icons">star</i></a>
</span>
</li>
</ul>
-
人
{{p}
{{说明[0]}
项目和描述是控制器中的数组。现在,我为我的项目数组中的每个项目都获得了一个listitem,但是如何迭代描述呢
就像在第一次迭代中一样:
<span>{{descriptions[0]}}</span>
{{descriptions[0]}
在项目中下一个p的下一次迭代中:
<span>{{descriptions[1]}}</span>
{{说明[1]}
谢谢你 在ng重复中使用
<ul class="demo-list-three mdl-list">
<li class="mdl-list__item mdl-list__item--three-line" ng-repeat="p in projects track by $index">
<span class="mdl-list__item-primary-content">
<i class="material-icons mdl-list__item-avatar">person</i>
<span>{{p}}</span>
<span class="mdl-list__item-text-body">
{{descriptions[$index]}}
</span>
</span>
<span class="mdl-list__item-secondary-content">
<a class="mdl-list__item-secondary-action" href="#"><i class="material-icons">star</i></a>
</span>
</li>
</ul>
-
人
{{p}
{{descriptions[$index]}
在ng repeat中使用
<ul class="demo-list-three mdl-list">
<li class="mdl-list__item mdl-list__item--three-line" ng-repeat="p in projects track by $index">
<span class="mdl-list__item-primary-content">
<i class="material-icons mdl-list__item-avatar">person</i>
<span>{{p}}</span>
<span class="mdl-list__item-text-body">
{{descriptions[$index]}}
</span>
</span>
<span class="mdl-list__item-secondary-content">
<a class="mdl-list__item-secondary-action" href="#"><i class="material-icons">star</i></a>
</span>
</li>
</ul>
-
人
{{p}
{{descriptions[$index]}
如果你太快了,你得等5分钟;)你太快了,你得等5分钟;)