javascript - Firebase: Push Item in If Statement -
i'm trying work out why function isn't pushing item
object availableproviders
array within if
statement.
serviceproviders.on('value', function(snapshot) { var availableproviders = []; snapshot.foreach(function(childsnapshot) { var key = childsnapshot.key(); providers.on('value', function(snap) { if (snap.haschild(key)) { var item = snap.child(key); availableproviders.push(item); } }); }); console.log(availableproviders); });
for reason console.log
@ end returns empty array.
any reason why item
isn't being pushed. appreciated. in advance!
Comments
Post a Comment