How to watch for ngSwitchCase in Ionic 2 / Angular 2?

1.1k Views Asked by At

I have a simple ngSwitchCase scenario

I want to watch for and get notified of ngSwitchCase in the controller, Basically when i switch between tabs.

Any ideas?

1

There are 1 best solutions below

3
Maximilian Riegler On BEST ANSWER

Looking at the docs I see there is an output event called ionChange. You could hook into that:

<ion-segment [(ngModel)]="selectedTab" (ionChange)="selectedTabChanged($event)">
    ...
<ion-segment>

And in your component you then have your method:

selectedTabChanged($event): void {
    // do something here
}