mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
5cdf6bc089
As described in https://github.com/angular/angular/discussions/49681#discussioncomment-5628930, if an `Observable` created from a signal with `toObservable` is subscribed to in a template, it will initially have `null` as the value. Immediately after the template is done executing, effects are flushed and this results in the `AsyncPipe` getting a new value before the `checkNoChanges` pass, resulting in `ExpressionChanged` error. ``` template: '{{obs$ | async}}' ... obs$ = toObservable(signal(0)); ``` Instead, this commit updates the `toObservable` to synchronously emit the initial value to the Observable stream. Side note here: We don't exactly encourage this pattern. Instead of using `AsyncPipe`, the template should just read signals. PR Close #49894
Angular
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT