consider
var adaRef = firebase.database().ref("users/ada");
How can I get the full path of ref ? that is "users/ada" ?
That's surprisingly simple:
adaRef.toString()
Will print the full URL: https://<your-app>firebaseio.com/users/ada
So to just get the path, you substring it out of there. Two ways of doing that are:
adaRef.toString().substring(firebase.database().ref().toString().length-1)
or:
adaRef.toString().substring(adaRef.root.toString().length-1)
both will print /users/ada
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With