Could you provide an example of the user service. I'm having trouble understanding how it would be constructed to be used in these components.
Thank you.
Hey John, sorry for the late reply. The example on StackBlitz is implementing a user service, however, that one is faking server-requests: stackblitz.com/edit/angular-pagina...
You'd need to implement the same signature but make HTTP-requests to your paginated server endpoint
exportclassUserService{constructor(privatehttp:HttpClient){}page(request:PageRequest<User>,query:UserQuery):Observable<Page<User>>{// parse HTTP-GET parameters that your server understands, e.g:constparams={pageNumber:request.page,pageSize:request.size,sorting:`${request.sort.property},${request.sort.order}`,text:query.search,registrationDate:query.registration}// make requestreturnthis.http.get("/users",{params}).pipe(map(/* map to Page<User>> if the type is different */))}}
Hope this helps, otherwise please ask further, I'll reply timely now
Could you provide an example of the user service. I'm having trouble understanding how it would be constructed to be used in these components.
Thank you.
Hey John, sorry for the late reply. The example on StackBlitz is implementing a user service, however, that one is faking server-requests: stackblitz.com/edit/angular-pagina...
You'd need to implement the same signature but make HTTP-requests to your paginated server endpoint
Hope this helps, otherwise please ask further, I'll reply timely now
That is just what I needed. I want to thank you for your article and your response. Take care.
Most welcome! You might want to join my mailing list so I can notify you when I publish something new :)