Im starting to a project and want to use firebase database to store data. Im able to save and load data but cant display them in the html page. Im javaScript newbie, so I cant really see whats wrong.
function loadArticle(articleId) {
return firebase.database().ref('/articles/' + articleId)
.once('value', function(snapshot) {
console.log(snapshot.val().headline);
console.log(document.getElementById("headline") != null);
document.getElementById("headline").innerHtml = snapshot.val().headline;
document.getElementById("article").innerHtml = snapshot.val().text;
});
}
Data is loaded and headline element is not null, but its text is not changed.
Aucun commentaire:
Enregistrer un commentaire