我有以下表格,
<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?
答案 0 :(得分:2)
$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>