我遇到了一个问题
我想向客户显示已实时收到新预订的弹出窗口。使用firebase,我可以侦听所有节点,并且节点运行良好,假设当我的任何客户预订房间时,客户端需要的应用程序都需要显示警报,就像收到新预订一样,并且需要确认。
在此之后,我需要使用firebase来检查新预订的价值并显示警报。
使用
Ionic 3
Angular 5
AngularFire2
监听代码是
var today = moment().format("YYYY-MM-DD");
var fbNode = '/bookings/'+today+'/'+this.clientId+'/'+this.clientSeatId+'/slotes/';
this.bookings = this.afDatabase.list(fbNode, ref => ref.orderByChild('start')).valueChanges();
我尝试了以下操作,但无法正常工作。
this.seatRef = this.afDatabase.list(fbNode, ref => ref.orderByChild('start'));
this.seatRef.stateChanges()
.subscribe(value => {
console.log(value);
if(actions.type=="child_added"){
if(actions.payload.val().type==1){
this.showConfirm(actions.payload.val());
}
}
});
GitHub问题发布:https://github.com/angular/angularfire2/issues/1739