2016-04-23 49 views
0

我將有如下一些搜索結果:使用
enter image description hereAngularJS:行號

標籤和AngularJS如下:

 <tbody> 
      <tr ng-repeat="customer in fndCtrl.result"> 
       <td> 
        1 
       </td> 
       <td ng-bind=":customer.CustomerNumber"></td> 
       <td ng-bind=":customer.FirstName + ' ' + customer.LastName"></td> 

我怎麼可以設置線路numbe,然後呢?上面的圖像設置爲1。

回答

0

做這樣的 -

<tbody> 
     <tr ng-repeat="customer in fndCtrl.result"> 
      <td> 
       {{$index+1}} 
      </td> 
      <td ng-bind=":customer.CustomerNumber"></td> 
      <td ng-bind=":customer.FirstName + ' ' + customer.LastName"></td> 
0

添加track by $index到NG-重複。修改後的代碼是

<tbody> 
     <tr ng-repeat="customer in fndCtrl.result track by $index"> 
      <td> 
       {{ $index + 1 }} 
      </td> 
      <td ng-bind=":customer.CustomerNumber"></td> 
      <td ng-bind=":customer.FirstName + ' ' + customer.LastName"> </td>