fbid fbid - 1 month ago 15
AngularJS Question

get Firebase object name value in ng-repeat

I need to use a Firebase Object name as parameter for the ui-router inside a

ng-repeat
.

I specify that fetching the favorite property as a Firebase array isn't an option.

OBJECT STRUCURE:

enter image description here

Is it possible to use the object name as a property inside a
ng-repeat
? As object name I mean for example
-K7YRDY2SP-kTN6...


I need to do something like this:

CODE:

<div ng-repeat="fav in favs = (current.favorites)"
ui-sref="app.show({'itemId':OBJECT_NAME})">

Name: {{fav.name}}
</div>

Answer

Yes it's possible.

<div ng-repeat="(key, value) in favs = (current.favourites)">
  Name: {{key}} <br/>
  Value: {{ value }}
</div>

Look it up in angular's office docs

EDIT

Added a jsfiddle

Comments