After utilizing AngularJS for a considerable amount of time, I have encountered some challenges with managing data sets.
Imagine having an array of items:
[
{ id: 1, votes: 10, detailInformation: 'Interesting #1' },
{ id: 2, votes: 12, detailInformation: 'Interesting #2' }
]
To keep the user informed with the latest information, I've set a $timer to fetch this data every 60 seconds from a REST webservice.
The presentation of these items to the user is in the following format:
| ID: {{item.id}} Votes: {{item.votes}} |
| <span data-ng-click="item.showInfo = true">Click here to view detail info</span> |
| <span data-ng-show="item.showInfo == true">{{item.detailInformation}}</span> |
Although this setup works well, when the timer updates the content, it resets the view state (item.showInfo = true). How can I effectively manage this client-only state separate from the server data that requires regular updates?