I am trying to retrieve a userId which is stored in the key name of an object : {userID:{firstname:foo, lastname:bar}}
I am doing this from an ionic view :
<ion-item ng-repeat="x in people" class="item item-icon-right"
ui-sref="app.people.profile({userId: x.howdoIextractmykeyname"}) >
I tried using this to extract the key name : Object.keys(myVar)[0]
ie:
<ion-item ng-repeat="x in people" class="item item-icon-right"
ui-sref="app.people.profile({userId: Object.keys(x)[0]"}) >
but this does not seem to work
Any help appreciated!
Ok so I just figured out how to do this :
<ion-item ng-repeat="(key,value) in people"
class="item item-icon-right" ui-sref="app.people.profile({userId: key})"
>