イオン2では、ストレージサービスの問題が繰り返し発生しています。私は正常に設定し、格納されたデータを取得しました。しかし、私が何かを保存すると、ページ/アプリケーションをリフレッシュしない限り、他のページにはアクセスできません。イオン2ストレージサービスと同期してストレージにアクセスする
例1:私は編集のコンタクトページにプッシュ接触
の編集、変更を行い、その後、saveEdits。 saveEditsは正常な連絡先に変更を行いますが、アプリケーションが更新されるまで連絡先リストを更新できません。
HTML:
<button (click)="saveEdits(newName, newPostCode)"ion-button round>Save Edits</button>
活字体:
saveEdits(newName, newPostCode){
console.log("saveid"+this.id);
this.name = newName; //saves property
this.postcode = newPostCode; //saves property
this.items[this.id] = {"id": this.id, "Name": newName, "PostCode": newPostCode};
this.storage.set('myStore',this.items);
//this.navCtrl.pop(ContactPage);
}
例2:私は連絡先を反復処理し、無線警告ボックスの一覧に表示し、別のページで、別のページにアクセスするの接点
。繰り返しますが、連絡先は正常に表示されますが、連絡先の追加ページで連絡先を追加すると、新しい連絡先がラジオの警告ボックスの一覧に表示されません。
addDests(){
console.log('adddests');
{
let alert = this.alertCtrl.create();
alert.setTitle('Choose Friend');
for(let i = 0; i<this.items.length; i++){
console.log('hello');
alert.addInput({
type: 'radio',
label: this.items[i].Name,
value: this.items[i].PostCode,
checked: false
});
}
alert.addButton('Cancel');
alert.addButton({
text: 'OK',
handler: data => {
console.log(data);
}
});
alert.present();
}
}
他の回答について私のコメントをチェックすることはできますか? – Dansmith12