1

I have some array of lets say orders. In current architecture, I am getting the list of all users every 5 seconds (I know that this is not the best approach, but unfortunately that wasn't my choice). Now, as my array grows (around 1000), and I want to display some image for each order, I can see a blink in the table (since I use Object.assign(this.orders, success.json()).

Due to this annoying blink, which I guess comes from the fact that angular2 needs to rebuild the front end each time I fetch new data, I am wondering how angular2 rebuilds the HTML components after the object has changed? Is there anything else that I can do so that angular doesn't rebuild the whole structure, only the parts that are missing?

uksz
  • 18,239
  • 30
  • 94
  • 161
  • Please add some code that demonstrates what you are doing. You can find how Angular does it in https://github.com/angular/angular/blob/f39c9c9e75671a7e235734b6b8aef263f6dff254/modules/%40angular/common/src/directives/ng_for.ts#L72 – Günter Zöchbauer Jun 15 '16 at 09:33
  • Use track by: http://stackoverflow.com/questions/36322829/how-to-use-track-by-inside-ngfor-angular-2. This prevents angular from rebuilding the while dom. – JB Nizet Jun 15 '16 at 09:37
  • @JBNizet, have you ever used ith with NgforOf? – uksz Jun 15 '16 at 09:41
  • Not that I remember. I haven't use Angular2 much yet. Why are you asking the question? – JB Nizet Jun 15 '16 at 09:43
  • You could loop through the orders from the response yourself and only add the new items. – Maximilian Riegler Jun 15 '16 at 10:54

0 Answers0