Only Show First Element Of Ng-repeat
How do I show only the first element in angular? I'm using ng-repeat like this:
{{ product.price }}
Solution 1:
You might also want to use
<divng-repeat="product in products|limitTo:1"><div>{{ product.price }}</div></div>
but yes the code below is better
<div>{{products[0].price}}</div
Solution 2:
Solution 3:
Alternately you can show the last in an array by doing this:
<div>{{ products[products.length-1].price }}</div>
Post a Comment for "Only Show First Element Of Ng-repeat"