I have data that looks like this:
$scope.items =[{name: "item1", year : "2013", value : "100"},
{name: "item1", year : "2012", value : "97"},
{name: "item1", year : "2011", value : "98" },
{name: "item2", year : "2013", value : "-7" },
{name: "item2", year : "2012", value : "-6" },
{name: "item2", year : "2011", value : "-5" },
{name: "item3", year : "2013", value : "93" },
{name: "item3", year : "2013", value : "91" },
{name: "item3", year : "2012", value : "93" },
{name: "item4", year : "2013", value : "-35" },
{name: "item4", year : "2012", value : "-36" },
{name: "item4", year : "2011", value : "-37" },
{name: "item5", year : "2013", value : "58" },
{name: "item5", year : "2012", value : "55" },
{name: "item5", year : "2011", value : "56" }]
I want to render the data as such:
Name 2011 2012 2013
item1 98 97 100
item2 -5 -6 -7
tiem3 93 91 93
item4 -35 -36 -37
item5 58 55 56
How can I achieve this using Angular? I understand the basics of ngRepeat but if I do ng-repeat = "(key, value) in items" and then value.name or value.year I have 15 instances of them instead of just item1 to item 5 and 2011, 2012 and 2013. Ideally I would like to have one loop that gives the years for the columns headers and one other loop that gives me the list of items for the rows, then i would reference the values by rows, columns. Any ideas?