I have two components Parent and child.
In parent there is HTTP call and there is a switchMap operator. Inside the loading status has changed as above:
this.subscriptions.add(this.personService.updatePerson(this.personId, personobject.list)
.pipe(
switchMap(() => {
this.setPersonUploadStatus(UploadStatus.FinishedSuccessfully);
this.setPersonsHierarchyUploadStatus(UploadStatus.InProgress);
return this.personService.updatePersonHierarchy(this.personId, personobject.list).pipe(share());
}),
finalize(() => {
this.setPersonUploadStatus(UploadStatus.NotStarted);
this.setPersonsHierarchyUploadStatus(UploadStatus.NotStarted);
})
).subscribe(
() => {
this.setPersonUploadStatus(UploadStatus.FinishedSuccessfully);
this.toastr.success(this.Translations['success']);
},
(response) => {
this.toastr.error(response.error.message, this.Translations['shared.error']);
}
));
private setPersonUploadStatus(uploadStatus: UploadStatus){
this.personUploadStatus = uploadStatus;
}
private setPersonsHierarchyUploadStatus(uploadStatus: UploadStatus) {
this.personHierarchyUploadStatus = uploadStatus;
}
below values are inputted to child component where is ngOnChanges method, which not call any change...
personHierarchyUploadStatus
personUploadStatus