tell me the best way to detect the status of several ajax requests in angular8?

You can use the forkJoin operator for your use case in two flavors :

1 – In your component constructor or ngOnInit do the following :

    candidateBasic: this.candidateService.getBasic(,
    experienceList: this.candidateService.getExperience(, 
    educationList: this.candidateService.getEducation(,
    certificationList: this.candidateService.getCertification(,
    candidateAbout : this.candidateService.getAbout(
.subscribe(e => this.selectedCandidateData = e)

And in your template use selectedCandidateData variable instead of selectedCandidateDataLoaded()


2 – write directly the forkJoin inside selectedCandidateDataLoaded() method and don’t subscribe.

selectedCandidateDataLoaded() : Observable<Candidate> {
   return forkJoin({...});

In your template use async pipe like :

*ngIf="selectedCandidateDataLoaded() | async"

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top