1
私は自分のコンポーネント内で観測可能なfirebaseオブジェクトを購読しています。このサブスクライブは、観測可能なスイッチが真から偽に切り替わるとき、またはその逆のときにリッスンします。 は現在、これは私のために働いて、それだけで私はそれがデータベースに正しく変更されていることを知っているにもかかわらず、偽(初期値を吐き出していません。コンポーネントの変更内で観測可能な購読が動作しない
サービス
private ReadyObs;
SetRoom(){
this.Room = this.AngularFire.database.object('/Rooms/ABC1');
this.Room.subscribe(snap => {
if(snap.$value !== null){
this.ReadyObs = this.AngularFire.database.object(`/Rooms/${player.room}/Ready`);
}
}
}
checkReady(){
return this.ReadyObs;
}
コンポーネント
private ReadyObs=this.main.checkReady();
//Always results with still not ready even though its true
this.ReadyObs.subscribe((result) =>{
if(result === true)
console.log("Ready to use");
else
console.log("Still not ready");
});
、それは例を残したり、手の込んだすることは可能でしょうか? –
あなたはReadyObsをチェックしていますが、これはFirebaseオブジェクトを正しく聞くことになっていますか? –
ReadyObsはどこで正確に設定していますか? –