I created an Ionic application with tabs and Ionics Storage for data storage.
In a tab (tab1), I have data and in another tab (tab2), I want to modify and set it in storage, but when I return to tab1, there is no change, only when I refresh.
The constructor is called only in the creation.
How can I fix that?
This is my ts 1tab
export class SaldoPage {
saldoAttuale:number;
controllo1Accesso:boolean= this.controllo();
constructor(public navCtrl: NavController, private storage: Storage,public zone:
NgZone) {
this.storage.get('saldoAttuale').then((val) => {
this.saldoAttuale = val;
console.log('entro');
});
}
controllo(){
this.storage.get('1accesso').then((val) => {
if(val == null){
val = true
}
else {
val = false
}
this.controllo1Accesso = val;
});
return this.controllo1Accesso;
}
conrollando1Accesso(){
this.storage.get('1accesso').then((val) => {
this.controllo1Accesso = val;
});
}
}