I have a service that get data from Firebase and show it in Home page. I have tabs and side menu together. When i click a page in tabs and go back to home there is no problem but when i click a non-tab page and go back to home, data is disappeared. I call service at home like that:
ngOnInit() {
this.subscription = this.calendarService.getCalendar().subscribe(res => {
this.events = res;
});
}
This is problematic itself. So i used ngOnDestroy at home page to unsubscribe like that and everything is ok:
ngOnDestroy() {
this.subscription.unsubscribe();
}
I wonder about why i have to unsubscribe because of non-tab pages?
Btw i get classical v4 error at non-tabs pages: router-outlet destroyed
Can Router Outlet problem cause that subscription problem?
Thanks in advance.