i created a method that change the theme of my app.
I tried to pass a theme variable to localstorage but without success, no effects.
I'd like to save the result of condition in local storage, so if i change route i can see the same theme setted before.
@HostBinding('class.light-theme') lightTheme: boolean = false;
@HostBinding('class.dark-theme') darkTheme: boolean = true;
theme: string = 'Dark';
toggleTheme(): void {
if (this.theme === 'Light') {
this.lightTheme = false;
this.darkTheme = true;
this.theme = 'Dark';
} else {
this.darkTheme = false;
this.lightTheme = true;
this.theme = 'Light';
}
}
}