ChangeDetectionStrategy.OnPush and Observable.subscribe in Angular 2

前端 未结 3 1937
轻奢々
轻奢々 2020-11-30 22:59

I\'m trying to wrap my head around best practice when using Observables alongside ChangeDetectionStrategy.OnPush.

The example demonstrates the common sc

3条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-30 23:34

    With this ChangeDetectionStrategy.OnPush you are telling your component to only listen for changes on it's input properties.

    I added loading component to your example just to show you how it works: http://plnkr.co/edit/k5tkmcLlzkwz4t5ifqFD?p=preview

提交回复
热议问题