angularjs - Display a value each time it changes in a repeater -
i have angularjs repeater.
<tbody data-ng-repeat="game in model.games | unique:'number'"> <tr><td colspan="3">{{game.location}}</td></tr> <tr> <td>{{game.number}}</td> <td>{{game.away}}</td> <td>{{game.home}}</td> </tr> </tbody>
in game
there property location
remain constant change @ point, instance:
[ { number: 1, location: 'place 1', home: 'team 1', away: 'team 2' }, { number: 1, location: 'place 1', home: 'team 3', away: 'team 4' }, { number: 2, location: 'place 1', home: 'team 1', away: 'team 2' }, { number: 2, location: 'place 1', home: 'team 3', away: 'team 4' }, { number: 3, location: 'place 2', home: 'team 1', away: 'team 2' }, { number: 3, location: 'place 2', home: 'team 3', away: 'team 4' }, { number: 4, location: 'place 2', home: 'team 1', away: 'team 2' }, { number: 4, location: 'place 2', home: 'team 3', away: 'team 4' } ]
each time changes want display it's value, not display when it's repeating.
if understand you're asking for, can use ng-show
show row current location not equal previous location.
<tr ng-show="game.location != model.games[$index-1].location">
Comments
Post a Comment