I am facing a challenge with the structure of my ng-repeat directive and I am having trouble navigating through it. Here is a representation of the data in array format JSON style
{"data":[
["sameer","1001",
[
{"button_icon":"fa fa-pencil",
"button_tt":"create invoice",
"button_color":"btn-success"
},
{"button_icon":"fa fa-pencil",
"button_tt":"create invoice",
"button_color":"btn-danger"
}
]
],
["jack","1002",
[
{"button_icon":"fa fa-pencil",
"button_tt":"create invoice",
"button_color":"btn-success"
},
{"button_icon":"fa fa-pencil",
"button_tt":"create invoice",
"button_color":"btn-danger"
}
]
]
}
The structure consists of an array that contains another array containing more arrays. The last internal array holds buttons to be appended with each row. I am struggling with appending these buttons. Although nested ng-repeats are already being used, I am finding the third one confusing.
This is the HTML code snippet:
<tbody>
<tr ng-repeat = "row in list.data">
<td ng-if = "(row.length - 1) != $index" class="text-center" ng-repeat = "val in row track by $index" ng-cloak>{{val}}</td>
<td ng-if = "(row.length - 1) == $index" class="text-center">
<div class="btn-group" ng-cloak>
<a ng-repeat = "btn in row" data-toggle="tooltip" title="{{btn.button_tt}}" class="btn btn-xs {{btn.button_color}}" data-original-title="Edit" ng-click="viewExpense(1)"><i class="{{btn.button_icon}}"></i></a>
</div>
</td>
</tr>