我有以下表格,
<tbody ng-repeat="attGroup in attributesGroups">
<tr>
<td class="vcenter text-right">
<a href="javascript:" ng-click="!$last && updateGroupOrder(attGroup.id,'down')" title="move down"><i class="entypo-down-open-big"></i></a>
<a href="javascript:" ng-click="!$first && updateGroupOrder(attGroup.id,'up')" title="move up"><i class="entypo-up-open-big"></i></a>
</td>
</tr>
<tr ng-repeat="att in attGroup.attributes">
<td class="vcenter text-right">
<a href="javascript:" ng-click="!$last && updateAttributeOrder(att.id,'down')" title="move down"><i class="entypo-down-open-big"></i></a>
<a href="javascript:" ng-click="!$first && updateAttributeOrder(att.id,'up')" title="move up"><i class="entypo-up-open-big"></i></a>
</td>
</tr>
你看我在attributesGroups ng-repeat和attributesGroups.attributes ng-repeat中都使用了$last/$first。现在我的问题是第二个$last和$first属于attributesGroups还是attributesGroups.attributes?
最佳答案
$first/$last
取决于调用它的上下文。
<tbody ng-repeat="attGroup in XXX">
<tr>
<!--- HERE $first/$last belongs to XXX --->
</tr>
<tr ng-repeat="att in YYY">
<!--- HERE $first/$last belongs to YYY --->
</tr>
</tbody>
关于javascript - 嵌套 ng-repeat $first 和 $last?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24800399/