My app list populate a table via ng-repeat like this:
<div ng-app="myapp">
<table ng-controller="mycontroller">
<thead class="thead-inverse">
<tr>
<th>Name</th>
<th>Email</th>
<th>Company></th>
<th>Adresse </th>
</tr>
</thead>
<tbody>
<tr class ng-repeat="contact in vm.contacts">
<td><a ng-href="/details/{{contact.id}}">{{contact.firstName}} {{contact.lastName}}</a></td>
<td>{{contact.email}}</td>
<td>{{contact.companyName }}</td>
<td>{{contact.street}}. {{contact.zip}}, {{contact.city}}</td>
</tr>
</tbody>
</table>
</div>
By clicking the link in the Name
field, I want to populate the detail page with the specific of that contact.
Now I am passing the contact.id
to a second controller to make a second call to the server and retrieve the data with a "GET CONTACT BY NAME".
MY QUESTION IS:
If I have already ALL the Contacts in the DOM, should it be better to filter then and show without a second call to the server?
Is there something like ng-repeat where id=id
? So I would like to click and filter the data in the DOM without going again to the server, since I have all the needed data already in front of me.