AngularJS ng-repeat show 1 data

Issue

Is it possible to using ng-repeat and show only 1 data.

Here’s my code:

<div class="modal-body" ng-repeat="a in list_data">
    <h2>Nama: {{a.nama}} </h2>
    <p>Alamat: {{a.alamat}}</p>
    <p>E-mail: {{a.email}}</p>
    <p>telp: {{a.telp}}</p>
</div>

Solution

you can use limitTo to limit the datas of ng repeat.

try this

<div class="modal-body" ng-repeat="a in list_data | limitTo : 1">
            <h2>Nama: {{a.nama}} </h2>
            <p>Alamat: {{a.alamat}}</p>
            <p>E-mail: {{a.email}}</p>
            <p>telp: {{a.telp}}</p>
</div>

Answered By – Syed mohamed aladeen

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published