1

I have to modify the UI for a Leshan Client. Currently the way it is setup, it displays every instance of the client in the browser. How do i make it display only 10 clients, although I will be still creating hundreds of them? I tried to modify the code below for ng repeat and ng click but the only thing that changes is that I stop displaying any of the clients.

    <tbody>
        <tr ng-repeat="client in clients" ng-click="showClient(client)">
            <td><a ng-href="#/clients/{{client.endpoint}}"> <strong>{{client.endpoint}}</strong></a> </td>
            <td>{{client.registrationId}}</td>
            <td>{{client.registrationDate | date:'medium'}}</td>
            <td>{{client.lastUpdate | date:'medium'}}</td>
            <td><i class="glyphicon glyphicon-info-sign" tooltip-html-unsafe="{{clientTooltip(client)}}"></i></td>
            <td><span ng-class="{hidden: client.secure == false}" class="glyphicon glyphicon-lock" tooltip-html-unsafe="Communication over DTLS"></span></td>
        </tr>
    </tbody>
James
  • 15
  • 2

2 Answers2

0
<tbody>
        <tr ng-repeat="client in clients | limitTo:10" ng-click="showClient(client)">
            <td><a ng-href="#/clients/{{client.endpoint}}"> <strong>{{client.endpoint}}</strong></a> </td>
            <td>{{client.registrationId}}</td>
            <td>{{client.registrationDate | date:'medium'}}</td>
            <td>{{client.lastUpdate | date:'medium'}}</td>
            <td><i class="glyphicon glyphicon-info-sign" tooltip-html-unsafe="{{clientTooltip(client)}}"></i></td>
            <td><span ng-class="{hidden: client.secure == false}" class="glyphicon glyphicon-lock" tooltip-html-unsafe="Communication over DTLS"></span></td>
        </tr>
    </tbody>
user2263572
  • 5,435
  • 5
  • 35
  • 57
0

use ng-if

<div ng-repeat="i in values">
    <div ng-if="i < 3">Hello</div>
</div>

working example

or use an auxiliar variable just to display the results you want

Tiago Bértolo
  • 3,874
  • 3
  • 35
  • 53