Joe82 Joe82 - 1 year ago 170
AngularJS Question

Angular JS - ng-repeat first element from an array of arrays

I have a set of data like this

$ = [
["Orange", 3],
["Blue", 2],
["Pink", 1],
["Red", 1],
["Black", 2],

I would like to do an ng-repeat that outupts just the first element of each array inside the main array (in other words, just the colors, but not the numbers). So far I made this code

<div ng-controller="myCtrl">
<div ng-repeat="color in data">
<div ng-repeat="n in color">

You can find a jsFiddle here

I tried to use
ng-repeat"n[0] in color"
, but the output is not the desired. Any idea would be appreciated. Thanks!

Answer Source

Try this:

<div ng-repeat="item in data">
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download