I am trying to utilize a function that is defined in tab1.ts
on the tabs.ts
page.
tabs.ts --|
--tab1.ts
Even though I have declared the variable, it returns undefined when I attempt to call the function.
tabs.ts
tab1: Tab1Page;
refreshData() {
this.tab1.routerWatch();
}
tab1.ts
routerWatch() {
this.routerSubscription = this.router.events.subscribe(
(event: NavigationEnd) => {
if (event instanceof NavigationEnd) {
if (event.url == '/tabs/tab1')
console.log(event.url);
this.authService.allPosts();
this.posts$ = this.authService.posts$;
}
}
);
}
My goal is to update my data once the user clicks on the 'home' tab button. However, the issue arises when attempting to access the data from the tabs page while the user is on the tab1 page.