Saeed Heidarizarei
Saeed Heidarizarei

Reputation: 8916

Reading variable from Firebase childs

I have many Telegram Keyboards in my Firebase, and I Want to Get Childs of specific keyboard that the user clicks on,
And msg.text is Variable of my Keyboards

const ref = db.ref('Keyboards/Keyboard1/childs');  //keyboard 1
const ref = db.ref('Keyboards/Keyboard2/childs');  //keyboard 2
const ref = db.ref('Keyboards/Keyboard3/childs');  //keyboard 3

How to add Keyboard[n], I mean msg.text in my ref?
If my input msg.text was = Keyboard1 I get Keyboard1 Childs and ...

It did not work

const ref = db.ref('Keyboards/msg.text/childs');

Notice When my Project was local with local json, I used below Code for this and Works Fine:
locale.keyboards[msg.text].childs

Upvotes: 1

Views: 65

Answers (1)

hasan
hasan

Reputation: 3502

You can try like following.

db.ref('Keyboards/' + msg.text + '/childs');

Upvotes: 2

Related Questions