Для итерации https://stackblitz.com/edit/ionic-shrsj2
в OptionsPage.html
<span *ngFor="let page of pages; index as i" >
<button ion-button
(click)="ViewSet(i)">
Broadcast OptionsChanged to View{{i+1}}
</button>
</span>
в OptionsPage.ts
pages = [
View1Page,
View2Page
];
constructor(
public ViewService: ViewService
) {
this.ViewSet(0);
}
ViewSet(i) {
this.ViewService.OptionChanged.next(this.pages[i]);
}
в TabsPage.html
<ion-tabs>
<ion-tab [root]="optionPage" tabTitle="Options" tabIcon="settings"></ion-tab>
<ion-tab [root]="tabPage" [tabTitle]="'View'" tabIcon="information-circle">
</ion-tab>
</ion-tabs>
optionPage = OptionsPage;
tabPage = ViewPages;
в ViewPages.ts
constructor(
public navController: NavController,
public ViewService: ViewService
) {
}
ionViewDidEnter() {
this.ViewService.OptionChanged.subscribe(data => {
this.navController.setRoot(data);
})
}