Q:

change text displayed when ion button is toggled

i am trying to change the text displayed from go online to go offline when i toggle the ion-toggle button in my ionic app. Here is my html code
 <ion-label color="light" *ngIf="!isOnline">Go Online</ion-label>
    <ion-label color="light" *ngIf="isOnline">Go Offline</ion-label>

  <ion-toggle (ionChanges)="updateDriverOnlineStatus($event)" [checked]="isOnline"></ion-toggle>

Here is my typescript file
public isOnline: boolean = false;

updateDriverOnlineStatus($event)
  {
  this.isOnline = !this.isOnline;
  }

How can i go about it?

A:

Try changing the event name to ionChange instead of ionChanges:
<ion-toggle 
  (ionChange)="updateDriverOnlineStatus($event)" 
  [checked]="isOnline">
</ion-toggle>

Also, you can do this with just one:
<ion-label color="light">{{ isOnline ? 'Go Offline' : 'Go Online' }}</ion-label>

Here's a Sample StackBlitz for your ref.

