Answer the question
In order to leave comments, you need to log in
How to set the limit of received elements from a JSON file in Angular 8?
There is a patients.json file containing patient data (about 1000 people) in this form:
{
"id": 1,
"name": "Denis",
"lastName": "Smith",
"age": 29,
"date": "Monday, January 10, 2015"
},
{
"id": 2,
"name": "Vasiliy",
"lastName": "Johnson",
"age": 25,
"date": "Friday, March 3, 2016"
}
getData(): Observable<Patient[]> {
return this.http.get<Patient[]>('/assets/patients.json');
}
this.patientsService.getData().subscribe((data) => {
console.log(data);
});
Answer the question
In order to leave comments, you need to log in
The backend should be paginated. In this case, trying to do pagination on the front is stupidly pointless, since this is a static file.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question