Load data from DB
Hello! When I try to load data used http services, always need to do other action before my data load, never load automatically, for example my service is
listAll(): Observable {
return this.http.get(this.variables.getServiceEndpoint() + '/clients/all/', {})
.pipe(catchError(err => {
this.notAllowed(err);
return throwError(err);
}
)
);
In my OnInit have that code
this.service.listAll()
.subscribe(i => {
this.clients = i as Clients[];
});
and in my table use this information
but never load alone, always need to click any bottom, for load
Can help me?
Thanks
Replies (3)
Hi,
I think I can direct you to the solution. Try to follow the article: https://www.digitalocean.com/community/tutorials/angular-change-detection-strategy.
You need use changeDetectionRef
and after the row this.clients = i as Clients[];
try to call this.cd.detectChanges();
. It should help you with your issue.
Regards,
Keenthemes support
that works!
Thank you so much !!
I am glad to see that you solved your issue.
Regards,
Keenthemes support