0

When data is being subscribed to the observable and service is called, how does change-detection set to onPush react to it?

  • Does this answer your question? [ChangeDetectionStrategy.OnPush and Observable.subscribe in Angular 2](https://stackoverflow.com/questions/35386822/changedetectionstrategy-onpush-and-observable-subscribe-in-angular-2) – Artem Arkhipov Dec 21 '22 at 12:41

1 Answers1

0

When you use an async pipe the view and its parents views will be marked as lViewFlags.dirty. If you don't use an async pipe OnPush will break on your component that subscribes. You can also use markForCheck()

Read more about it here: https://blog.simplified.courses/angular-change-detection-onpush-or-not/

Brecht Billiet
  • 235
  • 1
  • 6