admin管理员组文章数量:1289483
I have a firebase database having a child - "hello" having value - "one". Now, using the javascript, I need to set the value of "hello" as "two". Thanks in advance. Please help.
I have a firebase database having a child - "hello" having value - "one". Now, using the javascript, I need to set the value of "hello" as "two". Thanks in advance. Please help.
Share Improve this question edited Jan 14, 2017 at 17:14 Frank van Puffelen 600k85 gold badges889 silver badges859 bronze badges asked Jan 14, 2017 at 16:51 Hello WorldHello World 1131 gold badge3 silver badges6 bronze badges1 Answer
Reset to default 8This is a really basic question. The answer can be easily found in the firebase docs. I'd strongly remend you to always keep an eye on the docs when learning how to use firebase, because it is a great source and it covers a lot of use cases.
First, initialize your app
var config = {
apiKey: '<your-api-key>',
authDomain: '<your-auth-domain>',
databaseURL: '<your-database-url>',
storageBucket: '<your-storage-bucket>'
};
firebase.initializeApp(config);
Then, in your javascript, make sure you have a valid reference to your database and then run either one of these lines
firebase.database().ref("hello").set('two');
or
firebase.database().ref().update({hello: 'two'});
本文标签: javascriptSet value of a child in FirebaseStack Overflow
版权声明:本文标题:javascript - Set value of a child in Firebase - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741447944a2379312.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论