dulgan dulgan - 19 days ago 9
AngularJS Question

How to display the first data in ng-repeat?

How to display the first data in ng-repeat

<div class = "panel-body">
<div ng-repeat=" img in images">
<img src="http://photo/{{img.path}}" alt="">
</div>
Panel content




example sql
SELECT TOP 1 * FROM Customers;

Answer

Use ng-if="$index == 0"

See below

<img ng-if="$index == 0" ng-src="http://photo/{{img.path}}" alt="" />