I want to use a function that is defined in tab1.ts in the tabs.ts page.
tabs.ts --|
        --tab1.ts
I've declared the variable , but it gives me undefined when I 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$;
        }
      }
    );
  }
I want to refresh my data when the user clicks on the tab button 'home' , the problem is I cannot access the data from tabs page while the user is on the tab1 page
 
     
     
    