EmbeddedViewRef.detectChanges() and ngZone: noop

  angular, angular-changedetection, rxjs

For educational purposes I’m trying to build a directive that updates the UI even when NgZone is deactivated. The directive accepts an observable as an input and every time it emits a new value, it is supposed to update the UI with EmbeddedViewRef.detectChanges().

You can see in the example linked below, in observe.directive.ts, in the detect function, there is a console.log proving that the state itself is updating but the UI isn’t.

Hoping someone could explain why the UI isn’t updating.

CodeSanbox example

Source: Angular Questions

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.