Description
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
Yes
Description
Just updated to Angular v19 and started to experience an error. Created an example with as minimal code as possible. Unfortunately it doesn't make too much sense without additional context, but it is what it is.
So the setup is the following:
- We have a directive that has a required input (
ModelDirective
) - We have a component that queries a
ModelDirective
and uses its required input (FormFieldComponent
) - We also need to turn that input signal into an rxjs observable (for reasons that is not obvious by the example)
The problem is observed within the toObservable
but only if the queried directive is created dynamically within a dynamically created component. If you run the example, you can see that the input is actually set properly - if we directly use the computed signal, its value is successfully displayed. However, once we try to read the observable's value, an error is thrown.
If, however, the directive or the owning component is available without any condition, everything works fine (there is a commented line in the example template).
This setup was working fine in Angular v18.
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/stackblitz-starters-vjskep?file=src%2Fmain.ts
Please provide the exception or error you saw
ERROR RuntimeError: NG0950: Input is required but no value is available yet.
Please provide the environment you discovered this bug in (run ng version
)
Angular CLI: 19.0.3
Node: 20.11.1
Package Manager: npm 10.2.4
OS: win32 x64
Angular: 19.0.3
... animations, cli, common, compiler, compiler-cli, core
... localize, platform-browser, platform-browser-dynamic, router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.1800.3
@angular-devkit/build-angular 19.0.3
@angular-devkit/core 18.0.3
@angular-devkit/schematics 18.2.11
@angular/cdk 19.0.2
@schematics/angular 18.2.11
ng-packagr 19.0.1
rxjs 7.8.1
typescript 5.5.4
zone.js 0.15.0
Anything else?
No response