Hi all ! Suggest please, Is it possible that subscribe can not work on the same topic after unsubscribe ?
It works. Share your code, in case you did something wrong.
RaulGM, good day! I use such kind structure.
ionViewDidEnter(){
this.eventListener();
}
ionViewWillUnload():void {
this.events.unsubscribe(‘updater:data’);
}
eventListener() {
this.events.subscribe(‘Update:complete’, data=> {
});
}
if you want to unsubscribe in this case use the ionViewWillLeave event. Unload is only triggered if the view is kicked of the cache and then removed from the dom
bengtler, it help. Thanks a lot.
bengtler, Good day! Could you suggest please, is it possible don’t subscribe two times on the same event ? My event run two times and destroy my app.
Just in case, do you have only one subscribe ()
in your .ts file, right? If you have one subscribe on your ionViewDidEnter event and other on ionViewDidLoad event, only one of them are going to unsubscribe – and both are going to be running, causing the crash (that doesn’t happen to me though) --, while the other’s still gonna be executing.
In case you have more than one, name them differently.