I have an array of items filled up on ngOnInit
. below is my view
<mat-grid-list cols="4" rowHeight="150px">
<mat-grid-tile *ngFor="let item of lubricants; let i = index">
<img src="../assets/icons/washingIcons/upArrow.png">
</mat-grid-tile>
</mat-grid-list>
and this is my ts file:
import { Component, OnInit } from '@angular/core';
import { SellLubricantsService} from './sell-lubricants.service'
@Component({
selector: 'app-sell-lubricants',
templateUrl: './sell-lubricants.component.html',
styleUrls: ['./sell-lubricants.component.scss']
})
export class SellLubricantsComponent implements OnInit {
lubricants:any;
constructor(private sellLubServ:SellLubricantsService) { }
ngOnInit() {
this.getAllLubricants();
}
getAllLubricants(){
this.sellLubServ.getAllLubricants().subscribe(
Response=>{this.lubricants=Response;},
error=>{alert("error")}
);
}
}
this is working well to fill my page with tiles with 100 items but my need is to prevent loading all data when the array get bigger like 1000 items or more by setting pages. Many thanks for any help, i tried to follow the angular documentation but i didn't get how to apply it with my need. and i already imported the needed modules.