I'm trying to retrieve a value from a Firebase database and put the value in the variable "current_temp". I'm trying to get this done by using the code below (got some parts from the firebase docs), but It's not updating the variable "current_temp" outside the function. What am I doing wrong?
var TempRef = firebase.database().ref().child("temperature");
var current_temp=""
TempRef.on('value', function (datasnapshot){
current_temp = datasnapshot.val();
});
via Luke Janissen
No comments:
Post a Comment