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

Skip to content

Forms: Always use provided injector on the form level #62051

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

kirjs
Copy link
Contributor

@kirjs kirjs commented Jun 13, 2025

Always use provided injector on the form level


const injector = options?.injector ?? inject(Injector);
const pathNode = new FieldRootPathNode(undefined);
if (schema !== undefined) {
new SchemaImpl(schema).apply(pathNode);
runInInjectionContext(injector, () => new SchemaImpl(schema).apply(pathNode));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

runInInjectionContext is technically not needed unless the injector came from the options, though I assume this isn't very expensive and its fine to always do it

@kirjs kirjs force-pushed the forms-use-correct-injector branch from 77ec4fa to efa770d Compare June 18, 2025 18:23
@kirjs kirjs merged commit a833eb2 into angular:prototype/signal-forms Jun 18, 2025
10 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants