Change theme and color schema onload Apollo 14
Posted: 11 Aug 2022, 19:49
Hi!
I tried to save theme and color schema on localStorage.setItem when change it. I use app.config component in other component.
My code in other component is:
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute,
private router: Router,
private layoutService: HomeLayoutService,
private config: AppConfigComponent,
) { }
ngOnInit(): void {
if (localStorage.getItem('style')) {
let style = JSON.parse(localStorage.getItem('style')!);
this.config.changeColorScheme(style.colorScheme);
this.config.changeTheme(style.theme);
}
}
But not found. Any idea or suggestion for this objective.
I tried to save theme and color schema on localStorage.setItem when change it. I use app.config component in other component.
My code in other component is:
constructor(private formBuilder: FormBuilder,
private route: ActivatedRoute,
private router: Router,
private layoutService: HomeLayoutService,
private config: AppConfigComponent,
) { }
ngOnInit(): void {
if (localStorage.getItem('style')) {
let style = JSON.parse(localStorage.getItem('style')!);
this.config.changeColorScheme(style.colorScheme);
this.config.changeTheme(style.theme);
}
}
But not found. Any idea or suggestion for this objective.