How can I resolve my pagination error indication "it doesn't exist on type"?

Viewed 632

I want to add pagination to the products component, so there's only a maximum of 4 rows with 4 columns and you have to press a next button to see the next products. The pagination I tried implement gives a 'does not exist on type' error. enter image description here

The code in the html file is:

<div class="row">
        <div class="col-3"  *ngFor="let product of products | paginate: {productsPerPage: 5, currentPage:p}" >
            <a href="#" class="list-group-item clearfix" >
                <span class="pull-left">
                    <img 
                    src="{{ product.imagePath }}" 
                    alt="{{ product.name }}" >
                </span>
                <div class="productName">
                    <p>{{product.name}} </p> 
                </div>
            </a>s

            <div id="pagination">
                <pagination-controls (pageChange)="p=$event"></pagination-controls>
            </div>    
        </div>
    </div>
1 Answers
<pagination-controls (pageChange)="p=$event"></pagination-controls>

Instead of using this why dont you try in component

<pagination-controls (pageChange)="pageChanged($event)"></pagination-controls>

And call your next api request like this

pageChanged(event: any): void {
 this.apiService.getData(url?page=event);
}
Related