Firebase - 当我推送一个配置文件对象时,我想通过uid推送。而不是默认的给定ID

时间:2015-12-14 10:00:28

标签: typescript firebase angular

Firebase - 当我推送个人资料对象时,我想通过uid推送。而不是默认的给定ID。

我使用angular2,typescript和firebase。

我有个人资料json表。 配置文件表有一个配置文件列表。

我正在尝试添加个人资料对象。 我希望对象核心id是uid而不是自动生成的firebase。

1 个答案:

答案 0 :(得分:3)

如果没有看到您的代码,我就无能为力,但您需要使用var ref = new Firebase('https://<YOUR-FIREBASE-APP>.firebaseio.com'); var profile = { id: 'your-own-id', name: 'Firebase' }; ref.child('profiles').child(profile.id).set(profile); 来创建ID,然后设置对象。它会是这样的:

ROWID
相关问题