firebaseから値を読み込み、グローバル変数に代入しようとしましたが、動作しませんでした。firebaseから読み取った値を変数に代入する方法
public points: any;
readPoints(): any{
this.userProfile.child(this.user.uid).once('value').then((snapshot) =>{
this.points = snapshot.val().user_points;
});
}
console.log(this.points); //undefined
Users{
SAdS4cW57DSLuWr2obbZYUHsmAL2{
user_points: 20
.....
に代わりに割り当てた値の別の関数を呼び出すことで、あなたはあなたのデータベース構造のexempleと疑問に更新することができますか? –
私はdb構造を追加しました –