【发布时间】:2019-12-13 17:34:35
【问题描述】:
我正在尝试使用 angular 和 angularFire 更新 firebase 实时数据库上的数据, 数据发生了变化,但几秒钟后它又回到了原始数据,这是我正在使用的功能。
onSaveDateUpdate(){
let temp = {
period:{
startDate:'',
endDate:'',
periodType:''
},
updatedTime:("0" +(this.r.getMonth()+1)).slice(-2)+"/"+("0" +this.r.getDate()).slice(-2)+"/"+this.r.getFullYear()+" "+this.r.getHours()+":"+this.r.getMinutes()+":"+this.r.getSeconds()
};
var save =this.onEndDateValidator();
if(save){
temp.period.startDate = this.datePipe.transform(this.editStartDate,'MM/dd/yyyy');
temp.period.endDate = this.datePipe.transform(this.editEndDate,'MM/dd/yyyy');
temp.period.periodType = this.periodType;
const itemRef = this.db.object(URL );
this.showDateEdit = !this.showDateEdit;
itemRef.update(temp).then(() => {
...
});
}
【问题讨论】:
标签: javascript angular firebase firebase-realtime-database angularfire