2014-07-17 34 views
0

我有以下形式,

<tbody ng-repeat="attGroup in attributesGroups"> 
    <tr> 
     <td class="vcenter text-right"> 
      &nbsp;&nbsp;<a href="javascript:" ng-click="!$last && updateGroupOrder(attGroup.id,'down')" title="move down"><i class="entypo-down-open-big"></i></a> 
      &nbsp;&nbsp;<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"> 
      &nbsp;&nbsp;<a href="javascript:" ng-click="!$last && updateAttributeOrder(att.id,'down')" title="move down"><i class="entypo-down-open-big"></i></a> 
      &nbsp;&nbsp;<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重複和attributesGroups.attributes NG-重複。現在我的問題是,第二個$ last和$ first屬於attributesGroups或attributesGroups.attributes?

回答

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> 
相關問題