Just a general question about using track by $index in an ng-repeat, I couldn't find a solution in the docs...
I have a <div ng-repeat="concert in concerts track by $index">{{concert}}</div>
, below it, I have an array, that is dynamically populated with the concert's start time like this, <p>{{startTime[$index]}}</p>
. Some concerts, however do not have a valid start time, is there a way to figure out if there is a startTime for that [$index]
and if not, define the text that takes its place?
I know this is kind of open ended, & I could use a function to compare the length of concerts
array and startTimes
array, and populate the remaining fields in startTimes
with data, but I was hoping there may be an easier way? Best practice?
Thanks for your advice!