sorry for the confusing question. So currently i'm working with this block of code in Ionic, it looks like this:
home.ts :
ionViewDidLoad() {
this.myFunction().subscribe()( data => {
// Do some stuff here, then
// open another page/modal with the data received
this.openModal(anotherPage,data);
}
}
The problem, I believe, is that I have to do something to "unsubscribe" my current function since it's being called every second. I tried putting the whole code in the ionViewDidLoad, believing that when it jumps to another page the function will be suspended but it just doesn;t work.
openModal(zone) {
let modal = this.modalCtrl.create(ZonePage, { 'zone': zone });
modal.present();
}
Any idea to solve this situation?