【发布时间】:2018-08-21 16:33:32
【问题描述】:
目前在我的项目中,我正在将对象推送到特定参考中的 firebase:
this.CoursesList = this.mydb.database.ref('/courses/' + this.CourseCategoryForm);
this.CoursesList.push(this.course);
this.Reference();
但我想同时将它推到其他地方。我读到无法在 Firebase 中进行多重推送,因此我编写了函数 Reference 来根据其状态推送课程。
Reference(){
if(this.CourseStatusDecision == 0){
this.CoursesList = this.mydb.database.ref('/availableCourses/' + this.CourseCategoryForm);
}else{
this.CoursesList = this.mydb.database.ref('/currentSemester/');
}
this.CoursesList.set();
}
我的问题是我不想在另一个 ref 中再次推送整个对象(它通常使用不同的键推送,是因为 .push() 本身会自动创建一个键吗?),我只想要键当然,我只是将其推送并设置在另一个参考中,这可能吗?如何?谢谢。
【问题讨论】:
标签: angular typescript firebase firebase-realtime-database angularfire