次のアクション(たとえば、2回目のボタンをクリック)まで、何らかの理由でアプリケーションが更新されないようです。例えば約束のあるイオン2は、正しく表示をリフレッシュしません
:画面は、それがクリックされた第二の時間まで、{{usernameTemp}}部を有する場合showCredentialsをトリガする
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 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';
}
});
}
}
ワンクリック()関数は、スクリーン上usernameTemp表示されません。 これは以前の値を表示します。何かを書いてsaveCredentials()を使ってセーブすると、showCredentials()を呼び出して値を変更してsaveCredentials()を呼び出し、showCredentials()をもう一度呼び出します。二番目。
私にしか起こりませんか? 何か間違っていますか?
ありがとう、 Nimrod。