FirebaseExtended / angularfire

AngularJS bindings for Firebase

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't get id in child_changed event firebase

Gardezi1 opened this issue · comments

Version info

Angular: None

Firebase:3.5.3

AngularFire:None

Other (e.g. Node, browser, operating system) (if applicable):expressJS :4.14.0

Test case

Steps to reproduce

Expected behavior

Actual behavior

favorite
I'm kind of new to firebase. I was just trying out some example when I came across some of its event which by the way are pretty cool.

I have saved some data in firebase database which is :

 driver
      -KV_Cj7sL6sg6K9E5ifh
         status: "Incomplete"

The thing that troubling me is that when a child is updated child_changed event is triggered. When I access it's data I'm not seeing the key with it.

I have made a node(I think a row is called a node in firebase not sure) in the driver table. When I changed the status of it to complete the child_changed event it triggered. And I receive the packet which has been updated. The thing is I want to get the Id(KV_Cj7sL6sg6K9E5ifh) too. But the problem is it's only sending me status: complete.

This is the code that I have written for child_changed:

usersRef.on("child_changed", function(data) {
   var player = data.val();
   console.log(player);
   console.log("The new status is:  "+ player.status);
});

Pleas

@puf sorry for the cross post. I just read your instruction. Sorry