-1

I learned about change detection strategy - onPush and after that today i meet this video on youtube

https://www.youtube.com/watch?v=ybNj-id0kjY

where Minko is explaining about faster angular applications.

From 7:45 - 11:20 he is saying that -

When we have two components for example app component ( parent ) and employee-list component ( child ) and in the child component we are having inputs with keydown event, that makes CD - change detection to re-run. That is correct. He is saying for faster angular app we should use onPush strategy, and he makes that in the child component - but from the parent - app component he is sending now immutable js lists so they will be new reference - with onPush change detection we need new references sended to the input of the child component so it will run only then. But i don't get it

On 14:40 we can see that even on typing in inputs - keydown event again the child component is called - but new data is not sent from the parent to the child - because when we type only keydown event is called, but we didn't pressed enter to add the new event.target.value from the input into the array - that means input property in the child component is still not changed.

So why would he use changeDetection onPush in this situation when it does not help ?

sdsd
  • 447
  • 3
  • 20

1 Answers1

1

So the answer is - with this kind optimization, when the calculate method in the child component is called - he is called only for the sales and not for r & d department.

sdsd
  • 447
  • 3
  • 20