Hi,
I have a data set, such as
oddsData = {
'0-0': X,
'0-1': X,
'0-2': X,
'1-0': X,
'1-1': X,
'1-2': X,
'1-3': X,
'2-0': X,
'2-1': X,
'2-2': X,
'2-3': X,
'3-0': X,
'3-1': X,
'3-2': X,
'3-3': X,
'4-0': X,
'4-1': X,
'4-2': X,
'4-3': X
}
which I wish to be displayed in a tabular for like so:
1-0 X | 0-0 X | 0-1 X
2-0 X | 1-1 X | 0-2 X
2-1 X | 2-2 X | 1-2 X
3-0 X | 3-3 X | 1-3 X
3-1 X | | 2-3 X
3-2 X
4-0 X
4-1 X
4-2 X
4-3 X
with something along the lines of
<tr ng-repeat="trScores in scoreOdds | someFilter">
<td ng-repeat="tdScore in trScores">
{{tdScore}} {{scoreOdds[tdScore]}}
</td>
</tr>
However I'm not sure if this is the right approach and my few attempts at
writing the filter all ended up with infinite digest loops. (I'm returning
to this problem after some time, so I don't have an example of a failed
attempt I'm afraid). In my current approach I'd like
oddsScores | someFilter
to return
[['1-0', '0-0', '0-1'], ['2-0', '1-1', '0-2'], ..., ['4-3', null, null]]
but I must be returning a new object everytime the filter fires, hence the
infinite digest loop.
Any help with either:
1. fixing the infinite digest loop from my current approach; or
2. thinking up a better approach
would be much appreciated.
The only constraint I'd like to keep is that the data gets sent to the
template as is, ie it doesn't get preprocessed. This is because the
`oddsData` above gets played through different templates which are
dynamically chosen depending on the type of data they contain.
Thanks, David.
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.