Hey there! I've successfully implemented a toggle button that switches my Ionic 3 app to dark mode. However, I'm unsure about where exactly I should define the global class [class.dark-theme]="dark"
. It's essential for this class to be in the app.component.ts file in order to apply the changes throughout the entire app. Here's what I have done so far:
Here's the code snippet from any-page.html:
<ion-item>
<ion-label>
Dark Mode
</ion-label>
<ion-toggle [(ngModel)]="dark"></ion-toggle>
</ion-item>
And here's the content of variable.scss:
.dark-theme {
ion-label{
font-size: 33pt;
}
}
In app.component.ts, I have defined the following:
export class MyApp {
dark=false;
}
Can you provide guidance on how I can properly define the class for NgModel="dark"
as ([class.dark-theme]="dark")
? Thanks!