Patrioticcow Patrioticcow - 1 year ago 225
Javascript Question

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

I have a simple


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

Any ideas?

Answer Source

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)">

And in your component you then have your method:

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