Hi,
So I have 3 pages (2 normal view pages and 1 modal page). One of the 2 normal view pages (page A) opens the modal page, and the modal page calls the other normal view page (B).
There’s a button in B that updates the database and goes back supposedly to A. I need to make A be updated inline with the updated database such that after pressing the button in B, it calls again my APIs deployed in a web server. I am aware of ion view page lifecycle, and I think IonViewWillEnter/IonViewDidEnter might help me. However, upon using either of the two, it doesn’t get triggered after popping from B.
Any help?
Here are the snippets of the typescript files.
Normal View Page (A) that calls the modal. Method loadData is the call to API service
ionViewWillEnter() {
this.loadData();
}loadData(){
this.user = this.dataService.getParamData();
this.hcf_id = this.user.hcfId;
this.sub = this.roomService.getAllRooms(this.hcf_id).subscribe(e => {
this.rooms = e;
});
this.sub2 = this.roomService.getAllRoomByType(this.hcf_id, 1).subscribe(e => {
this.commonRooms = e;
});
this.sub3 = this.roomService.getAllRoomByType(this.hcf_id, 2).subscribe(e => {
this.functionalRooms = e;
});
}async showDetails(response: Room){
const modal = await this.modalController.create({
component: ModalPage,
componentProps: {
room: response
}
});
modal.present();
}
Modal page that calls normal view page B
closeModal(){
this.modalController.dismiss();
}editLPGRP(room_id: Number){
this.dataService.pushTempData(this.lpgrpGen);
this.navCtrl.navigateForward(‘lpgrfgen’);
this.closeModal();
}
Normal View Page B which has a button to update the database thru API and pops back to A
calculateFunctionality(){
this.lpgrpAssessmentService.updateGenAssessment(this.lpgrpGen).subscribe();
this.navCtrl.pop();
}
else{
alert(“Please finish assessing all the elements before calculating functionality!”);
}
}