Mateusz Mateusz - 2 months ago 16
TypeScript Question

Angular 2 - get last 5 records from database

how can I get last 5 records from database?


<table class="table table-striped table-bordered">
<th>Logging in is completed?</th>
<tr *ngFor="let log of logs">

<td >{{}}</td>
<td >{{log.isCompleted}}</td>



With above code I get all records. I would like to do something similar to:

for(int i=logs.length();i>logs.length()-5;i--)


I did it that way:

  <tr *ngFor="let log of logs; let i =index">

                    <td *ngIf ="i>=logs.length -5">{{}}</td>
                    <td * ngIf="i>=logs.length -5">{{log.isCompleted}}</td>