Angular Firebase实时数据库推送到对象的值
我需要在父对象和遵循相同模式的多个子对象之间创建一个关系Angular Firebase实时数据库推送到对象的值,angular,typescript,firebase-realtime-database,Angular,Typescript,Firebase Realtime Database,我需要在父对象和遵循相同模式的多个子对象之间创建一个关系 export interface Structure { key?: any | null; id?: number | null; material?: any | null; active?: boolean | null; require?: boolean | null; options?: string[] |null; <-- this should be a list o
export interface Structure {
key?: any | null;
id?: number | null;
material?: any | null;
active?: boolean | null;
require?: boolean | null;
options?: string[] |null; <-- this should be a list of child Id's
parent?:any | null;
}
创建父对象中data.options下存储的子键列表并能够添加和删除子键的最佳方法是什么?屏幕截图是所需结构的一个示例。
[屏幕截图是所需结构的示例。]]
createStructures(data: Structure) {
if (data.parent ){
this.db.list("structures/" + data.parent + '/options').push(data.key) *
this.db.object("structures/" + data.parent+"/options").set(data.key) *
}
this.structures.push(data);
}