2016-07-02 5 views
1

私のデータがいつpush()メソッドを使ってDBに保存されたかを知る方法はありますか?私は、次のコードを書いたが、私が間違っていないよ場合は、データを複数回...Firebase - push()コールバック

db.ref('news').push(opts).then(() => { 
    // do smth. (e.g. hide preloader) when data were succesfully saved 
}) 

答えて

4

は、プッシュ()コールバックは次のようにする必要があります保存されます。

db.ref('news').push(opts, function(error) { 
    if (error) 
    console.log('Error has occured during saving process') 
    else 
    console.log("Data hss been saved succesfully") 
}) 
関連する問題