Add Next and previous button in Angular GET API

I display a list of data on my page.
Now the client says display one and then add next and previous button for pev and next.
I can’t use pipe use these demos.

my code is.

        <div *ngFor="let l of list">        
            <ion-card mode="ios" *ngIf="!=null">
                  <div class="ion-des" [innerHTML]="| safe"></div>

and my typescript code is

 getMenu() {
      .then((data: any) => {
        this.list =;


 "Tabledata": [



I need this way-


Instead of data 1, data 2, data 3, …, data n
I need to add data 1 and Next and Previous btn on this page.

19 thoughts on “Add Next and previous button in Angular GET API”

  1. What you are looking for is "pagination".

    In my opinion a good approad is that your API only returns one item instead of a list.
    But your API needs a option to take additional query parameters like ?page=2 or ?limit=1&offset=1 which both would return the second item.

    Then you do not need to loop through the list but you only get one item and show it as a card. With a click on the next button you call your API with ?page=3 and get the next item.

    To show Page 2/10 on every page you need to return the total amount of pages too.


    You load the whole list on page load and only show one item at a time. If you click on next, show the next item in the array.


Leave a Comment