I use ng-repat to populate an html table with an array.
I have problems normalizing the naming of each property in the array.
Some users are very stubborn and now I have to find a quick work around, if possible.
my array AgendaItems sometimes comes like:
{"Agenda Item":"1","Legistar ID":"62236","Title":"Approval of Minutes","Meeting ID":"49837"}
Other times comes like:
{"AgendaItem":"1","LegistarID":"62236","Title":"Approval of Minutes","MeetingID":"49837"}
The html:
<tbody ng-repeat="ai in AgendaItems">
<tr>
<td>{{ai.MeetingID}}</td>
<td>{{ai.AgendaItem}}</td>
<td>{{ai.LegistarID}}</td>
<td>{{ai.Title}}</td>
</tr>
</tbody>
Is there a way that I can use an index value instead that, for example: ai.[i] That way I do not have to worry whether the columns are name with or without a space in between?
Any help is much appreciated.
Thank you, Erasmo
ng-repeatto scoped variables like$index. However, using$indexwhen iterating over an object rather than an array is rather questionable.