Hi Sander, 

thank you very much for your help. I added a unique ID to each object. I 
have another interesting case:

The table gets very big, with thousands of lines. I'll add a pagination in 
order to avoid excessive scrolling. I need to have all data in the page, I 
can't use live scroll. I won't send all the table information every second. 
I will send only the information that was changed in the last 5 seconds. 
This will reduce the network traffic. In this case, if I use the same 
approach as we discussed in this topic, the AngularJS will delete the old 
data from table when receiving only a small part of whole data.

I would like to extend or doing another patch in order to indicate to 
AngularJS that I don't want to delete any information in this case. The 
usage of 'track by' feature in ng-repeat is mandatory! I don't want to live 
without 'track by' any more.

Do you have any ideas?

Em quinta-feira, 13 de fevereiro de 2014 04h48min36s UTC-2, Sander Elias 
escreveu:
>
> Hi Alexandre,
>
> I’m glad you figured it out. Your example shows nicely that the track by 
> feature works as a charm!
> There is still something that has to be added, the track by feature 
> requires an unique identifier.
> As an example, it you don’t have an unique ID, you can combine it with the 
> name like this:
> <tr ng-repeat="a in actualArray track by a.id+a.name">. As an alternative 
> you can also do
> <tr ng-repeat="a in actualArray track by $index"> but then it’s not 
> binded to your data at all.
>
> Regards
> Sander
>

-- 
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/groups/opt_out.

Reply via email to