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

前端 未结 5 1500
故里飘歌
故里飘歌 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:05

    I saw a really nice and simple explanation in that link:

    http://www.codecompiled.com/change-detection-in-angular-2/

    ChangeDetectionStrategy.OnPush: it will update the view only in specific scenarios:
    * When some event is fired.
    * When value of input changes.

    Default mean: Always update the view.

提交回复
热议问题