Answer the question
In order to leave comments, you need to log in
How to properly store data after a request in a service?
Good day,
I can not fully understand the services. The request to the backend passes once (as it should). But going to another page, and then returning back, the data cannot be collected correctly.
I output them to the "Data Tables" table via *ngFor. When the page is first opened, a request is made to the backend and everything is displayed and working well. But when you come to the page again, the data is visible, but on any action it disappears (for example, when trying to sort)
Component:
public dataTestServices: any;
constructor(private servicesServices: ServicesService) {
}
ngOnInit() {
this.servicesServices.getTestServices().subscribe(
data => {
this.dataTestServices = data.test_services;
});
}
getTestServices() {
return this.jsonApiService.getQuery('service/get_test');
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question