hi i success fully create dark theme mod and its working in devices but after exit app toggle data not saved
need help how to save toggle data in app
hear is a my code
<ion-list>
<ion-item>
<ion-icon slot="start" name="moon"></ion-icon>
<ion-label>Toggle Dark Theme</ion-label>
<ion-toggle slot="end"
[ngModel]="darkMode"
(ionChange)="cambio()"></ion-toggle>
</ion-item>
</ion-list>
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
@Component({
selector: 'app-folder',
templateUrl: './folder.page.html',
styleUrls: ['./folder.page.scss'],
})
export class FolderPage implements OnInit {
darkMode: boolean = true;
public folder: string;
constructor(private activatedRoute: ActivatedRoute) { }
ngOnInit() {
this.folder = this.activatedRoute.snapshot.paramMap.get('id');
}
cambio() {
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)');
this.darkMode = !this.darkMode;
document.body.classList.toggle( 'dark' );
}
}
i found in google search how to stored data but its difficult because i am new in ionic development and still learning any one help me to solve my problem