Only show first element of ng-repeat

angularjs, javascript

Solution

Don't use ng-repeat directive, this should work:

<div>{{ products[0].price }}</div>

Problem

How do I show only the first element in angular? I'm using `ng-repeat` like this: ``` <div ng-repeat="product in products" ng-show="$first"> <div>{{ product.price }}</div> </div> ``` But since I'm not repeating, then I shouldn't have to use `ng-repeat`? How can I get this to display just the first, without having to go in a ng-repeat?

Original source