0

Can someone help me pull the unique object name from contents ($Id). I'm able to loop over $scope.data in my template with ng-repeat but I can't get the name of that array. Need this to build a URL reference.

In short, how do I get "2015-02-27T20:24:11-06:00"? I can pull out item.count, item.handle, item.img_url, but {{item.$id}} doesn't work.

obj.$asArray();

object of arrays

obj.$asObject();

enter image description here

1
  • Seems like a great place to start here would be the guide. It will save you some thrashing with basic concepts like these. Commented Mar 7, 2015 at 6:10

1 Answer 1

1

If you fetch the data $asArray() and save it on $scope.data you should simply be able to get the $id as you describe.

<div ng-repeat="item in data">
  <p>id: {{item.$id}}</p>
</div>

However, I can't help but notice that your casing in $Id is wrong.

Sign up to request clarification or add additional context in comments.

4 Comments

Tried your suggestion still didn't get the results (even with the casing change you pointed out). Almost like it is not binding through to the template.
I find it strange that item.handle returns expected data while item.$id does not. Can you make a Plunker (or similar) that shows this issue ?
i agree. i couldn't figure it out after a few days so that's why i broke down and posted here.
@billm you ever figure it out? I'm having the exact same issue. item.value prints my value but item.$id does not

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.