I'm in the process of developing a cross-platform application. I have a TabView Component that needs to update a tab after sending data to the server. During the initialization (ngOnInit) phase, I dynamically set the content of my tab. However, when I send the data to the server and navigate to the summary page, ngOnInit is not called again, leading to the content not being updated. Any suggestions on how to achieve this?
Highlighted code snippet
home.component.ts
ngOnInit(){
this.homeService.getPrenotazioni().subscribe((res) => {
var layout = <StackLayout>this.page.getViewById("prenotazioni");
//...set content...
};
}
tabs.component.html
<GridLayout>
<TabView androidTabsPosition="bottom">
<page-router-outlet *tabItem="{title: 'Home'}" name="homeTab"></page-router-outlet>
<page-router-outlet *tabItem="{title: 'Prenota Ritiro'}" name="prenotaritiroTab"></page-router-outlet>
<!-- other tabs -->
</TabView>
</GridLayout>
After sending data from the "Prenota ritiro" tab and switching to the "Home" tab, I aim to refresh the content within the "Home" tab.