2
我開發了一些使用Firebase的應用程序。隨着時間的推移,我意識到我重複了很多不必要的代碼,並決定創建一個小型庫來幫助我提高生產力。就在開始的時候,我試圖創建該對象在Javascript:創建基本庫的Firebase錯誤
read.childRoot = function(att) {
var acessChildRoot = firebase.database().ref("root/");
acessChildRoot.once('value').then(function(snapshot) {
alert(snapshot.child("nome").val());
});
}
我試圖通過這行代碼來訪問:
alert(read.childRoot("nome"));
所以我能讀我想要的參考,但第一個回報是未定義的值。我如何過濾這個值並顯示我真正想看到的值?