【发布时间】:2016-05-31 22:52:05
【问题描述】:
我有一个对象如下:
scope.items = {
"poor-John-1": {
"_id": "poor-John-1",
"name": "poor-John-1",
"sName": "room-poor-John-2"
},
"poor-John-2": {
"_id": "poor-John-2",
"name": "poor-John-2",
"sName": "room-poor-John-2"
}
}
我已经通过以下方式渲染了对象
<tr ng-repeat="item in items | orderObjectBy: '_id' track by item._id" ng-class="getStyle(item, next_item)"><td>{{item.sName}}</td></tr>
我想要做的是,将 current 和 next_item 传递给 getStyle 函数,因为它不是数组,$index 没有指向值。我在对象中有数据。
【问题讨论】:
标签: angularjs object angularjs-ng-repeat