2016-12-17 9 views
2

いくつかの製品でng-repeatとpaginatedが表示されています。 ng-ifを使って私を助けてくれる人がほしいと思っています - もしng-repeatが終わったとき、またはページネーションが終わったときに製品がなくなったと言ってもいいですか?これは、4つの製品がありenter image description hereAngularJS-ng-repeat、終了時に、「他の製品がありません」というメッセージが表示されます

<span ng-if='curPage >= category.data.length'> 
          <center><p class="no-products"> There are no more products to show </p> </center> 
         </span> 

<div class = "col col-25" ng-repeat="product in category.data| pagination: curPage * pageSize | limitTo: pageSize">    
         <a href="#/tab/details?product_id={{product.id}}"><img class="full-image" src="{{product.link}}"> 
         </a> 
         <center> <p class="productnamei"> 
           <strong> {{product.name}}</strong> </p>      


         <a ng-href="#/tab/details?product_id={{product.id}}" class="button button-small button-calm"> 
          Buy Now 
         </a> 


        </div> 

答えて

2

繰り返し要素がイテレータで最後である場合は、真の最後の$($最後のブール値でそれを確認することができますになり、1ページ内に(カルーセル前の-次のようなものです。)

<body ng-app="app"> 
    <div ng-repeat ="item in [1,2,3]" tooltip> 
    <span data-toggle="tooltip" ng-bind="item"></span> 
    <div ng-if="$last">Completed</div> 
</div> 
</body> 
関連する問題