What is ChangeDetectionStrategy in Angular2 and when to use OnPush Vs Default?

前端 未结 5 1492
故里飘歌
故里飘歌 2020-12-15 09:16

I happened to see ChangeDetectionStrategy in the ngrx documentation. It uses OnPush.

What is ChangeDetectionStrategy in Angula

5条回答
  •  北海茫月
    2020-12-15 10:11

    Change detection is a feature provided by angular framework which is responsible for checking the changes happing in between the specified component with parent child relationship.

    1. Change detection makes angular application more efficient you use it wisely.

    2.It has two strategy onPush and Default.

    3.OnPush Strategy gets executed when the specified object in component gets modified.Otherwise it remains as it's. That's why It makes efficient.

    4.Default strategy makes application to work gets executed whenever it finds changes.

提交回复
热议问题