0
<tr *ngFor="let post of posts">

    <td>{{post.kind}}</td>
    <td>{{post.title}}</td>
    <td>{{post.author}}</td>
    <td>{{post.publisher}}</td>
    <td>{{post.year}}</td>
    <td>{{post.length}}</td>

  </tr>

The problem is that posts has over 200 objects in it, and I want to limit it to 10, then if I click next (or previous), it lists the next/previous 10. How should I do this?

P1311
  • 1
  • 1
  • 1

2 Answers2

0

You could use a pipe. To implement that. The pipe Method could look like that:

public transform(items: [], limit: number) {
    return items.slice(0, limit);
}

In Template:

*ngFor="let post of posts | limitPipe:20"
David Ibl
  • 901
  • 5
  • 13
0

you can do something like this:

<div *ngFor="let post of posts" let-i="index">
  <li class="dropdown-item" (click)="onClick(item)" *ngIf="i<10">{{post .text}}</li>
</div>
Abhishek Ekaanth
  • 2,511
  • 2
  • 19
  • 40