Skip to content
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

fix(core): use correct injector when resolving DI tokens from within … #42886

Conversation

@JoostK
Copy link
Member

@JoostK JoostK commented Jul 17, 2021

…a directive provider factory

When a directive provides a DI token using a factory function and
interacting with a standalone injector from within that factory, the
standalone injector should not have access to either the directive
injector nor the NgModule injector; only the standalone injector should
be used.

This commit ensures that a standalone injector never reaches into the
directive-level injection context while resolving DI tokens.

Fixes #42651

…a directive provider factory

When a directive provides a DI token using a factory function and
interacting with a standalone injector from within that factory, the
standalone injector should not have access to either the directive
injector nor the NgModule injector; only the standalone injector should
be used.

This commit ensures that a standalone injector never reaches into the
directive-level injection context while resolving DI tokens.

Fixes #42651
@JoostK JoostK force-pushed the JoostK:core/di/standalone-injector-directive-factory branch from 0995ade to ea6c110 Jul 17, 2021
@@ -92,6 +92,9 @@
{
"name": "injectArgs"
},
{
"name": "injectInjectorOnly"

This comment has been minimized.

@JoostK

JoostK Jul 17, 2021
Author Member

This one was not newly referenced (it's not called by setInjectImplementation) and I suspect this used to be inlined by the optimizer, which it appears to have stopped doing after this change.

@JoostK JoostK marked this pull request as ready for review Jul 17, 2021
@pullapprove pullapprove bot requested a review from atscott Jul 17, 2021
@atscott
Copy link
Contributor

@atscott atscott commented Jul 19, 2021

alxhub added a commit that referenced this pull request Jul 20, 2021
…a directive provider factory (#42886)

When a directive provides a DI token using a factory function and
interacting with a standalone injector from within that factory, the
standalone injector should not have access to either the directive
injector nor the NgModule injector; only the standalone injector should
be used.

This commit ensures that a standalone injector never reaches into the
directive-level injection context while resolving DI tokens.

Fixes #42651

PR Close #42886
@alxhub alxhub closed this in 307dac6 Jul 20, 2021
@angular-automatic-lock-bot
Copy link

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Aug 20, 2021

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Aug 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants