Hi,
It seems that the application doesn’t refresh for some reason until the next action.
For example:
import {Component} from '@angular/core';
import {SqlStorage} from "ionic-angular";
@Component({
templateUrl: 'build/pages/authenticate/authenticate.html'
})
export class AuthenticatePage {
private username: string;
private storage: SqlStorage = null;
private usernameTemp: string;
constructor() {
}
saveCredentials(){
// this.storage = new Storage(SqlStorage);
this.storage = new SqlStorage();
this.storage.set("username", JSON.stringify(this.username));
}
showCredentials(){
let sqlStorage = new SqlStorage();
sqlStorage.get('username').then((data) => {
if (data != null){
this.usernameTemp = JSON.parse(data);
} else{
this.usernameTemp = 'fail';
}
});
}
}
One click that will trigger the showCredentials() function won’t show usernameTemp on screen if the screen has a {{usernameTemp}} section until the second time it is clicked.
It always shows the former value - if you write something and saves it using saveCredentials(), then call showCredentials() then change the value and call saveCredentials(), then call showCredentials() again - you will see the first username, not the second.
Is it possible that happens only to me?
Am I doing something wrong?
Thanks,
Nimrod.