Thanks to visit codestin.com
Credit goes to github.com

Skip to content

reading required signal input from effect causes error NG0950 when done inside structural directive creating an embedded view after promise resolves #55311

Closed
@jnizet

Description

@jnizet

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

When using a directive which defines an effect reading a required signal input from inside an ng-container using a structural directive which renders its view after a promise resolves, an error NG0950 (Input is required but no value is available yet) is thrown.

The same code works fine when used outside of the container with the structural directive.

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/edit/stackblitz-starters-nk7kmy?file=src%2Fbug.directive.ts,src%2Ffoo.directive.ts,src%2Fmain.ts

Please provide the exception or error you saw

Error: NG0950: Input is required but no value is available yet. Find more at https://angular.io/errors/NG0950
    at _BugDirective.inputValueFn [as title] (chunk-BKDHUOG3.js?v=8ee0a5cd:3411:13)
    at EffectHandle.effectFn (main.ts:21:24)
    at EffectHandle.runEffect (chunk-BKDHUOG3.js?v=8ee0a5cd:24021:12)
    at Object.fn (chunk-BKDHUOG3.js?v=8ee0a5cd:24016:52)
    at Object.run (chunk-BKDHUOG3.js?v=8ee0a5cd:341:12)
    at EffectHandle.run (chunk-BKDHUOG3.js?v=8ee0a5cd:24028:18)
    at ZoneAwareEffectScheduler.flushQueue (chunk-BKDHUOG3.js?v=8ee0a5cd:24006:14)
    at chunk-BKDHUOG3.js?v=8ee0a5cd:23997:31
    at _ZoneDelegate.invoke (zone__js.js?v=a72eca7f:299:158)
    at Object.onInvoke (chunk-BKDHUOG3.js?v=8ee0a5cd:12023:25)

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 17.3.4
Node: 18.18.0
Package Manager: npm 10.2.3
OS: linux x64

Angular: 17.3.4
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1703.4
@angular-devkit/build-angular   17.3.4
@angular-devkit/core            17.3.4
@angular-devkit/schematics      17.3.4
@schematics/angular             17.3.4
rxjs                            7.8.1
typescript                      5.3.3
zone.js                         0.14.4

Anything else?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1Impacts a large percentage of users; if a workaround exists it is partial or overly painfularea: coreIssues related to the framework runtimebugcore: reactivityWork related to fine-grained reactivity in the core frameworkcross-cutting: signals

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions