iJade
iJade

Reputation: 23791

How to query firebase to retrieve the unique ID

I'm querying data from Firebase using the following code :

var firebaseObj = new Firebase("https://example.firebaseio.com/Articles");

var sync = $firebase(firebaseObj);

$scope.articles = sync.$asArray();

which return the following data :

    [{
    "emailId": "[email protected]",
    "post": "fgh",
    "title": "hfgh"
}, {
    "emailId": "[email protected]",
    "post": "HHHHHH",
    "title": "Hello"
}, {
    "emailId": "[email protected]",
    "post": "Big news",
    "title": "Today's news"
}]

Each of the returned entry under https://example.firebaseio.com/Articles has a unique ID which is missing from the returned result. How to retrieve the unique ID.

Upvotes: 1

Views: 537

Answers (1)

AJcodez
AJcodez

Reputation: 34156

Try the special $id property, the relative unique firebase key.

Upvotes: 5

Related Questions