I have an array of objects as below:
$scope.objects = [ { "artist": "bob", "title": "hey", "genre": "pop" }, { "artist": "mary", "title": "why", "genre": "pop" } ] I'm trying to iterate through them in my html as below:
<tr ng-repeat="object in objects"> <td>{{object.artist}}</td> <td>{{object.title}}</td> <td>{{object.genre}}</td> </tr> It's not working and it doesn't show anything.
What would be ideal is if I could turn that array of objects into just an Object. It seems like ng-repeat can iterate over that no problem.
Is there anyway to get this working? Or even better, is there a way to turn an Array of Objects into an Object that contains more objects?
Thanks!
EDIT - Adding specific details of my case below:
I set $scope.tracks = queryTracks();
function queryTracks() returns an array that I've logged to the console. The console log shows this:
[ {"artist":"Tiesto", "created":"2014-06-25T04:30:01.043Z", "genre":"trance", "imgurl":"http://www.youredm.com/wp-content/uploads/2012/11/tiesto-traffic-magik-muzik-youredm.jpg", "owner":"117", "rating":"", "readabledate":"Tue Jun 24 2014", "title":"Traffic", "trackid":"-JQGHErWDwOWfJsLMNSm", "yturl":"TpkUJfykRiA"} ] I've only listed one object in the above array, but the actual returned array contains many of these kinds of objects.
For some reason, ng-repeat is unable to parse and use the data.
<tr>in a<table>tag?