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

Encountering a NullInjectorError: No provider for _RadioControlRegistry! error when using @defer block #54117

Closed
surajchopra1234 opened this issue Jan 27, 2024 · 4 comments
Assignees
Labels
area: core Issues related to the framework runtime core: defer Issues related to @defer blocks. P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Milestone

Comments

@surajchopra1234
Copy link

surajchopra1234 commented Jan 27, 2024

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

core

Is this a regression?

Yes

Description

Encountering a NullInjectorError: No provider for _RadioControlRegistry! error when using an input type="radio" element within a component that is defer loaded using the @ defer block in Angular. This issue seems to prevent radio button functionality within defer-loaded components

Please provide a link to a minimal reproduction of the bug

https://stackblitz.com/~/github.com/surajchopra1234/demo

Please provide the exception or error you saw

ERROR NullInjectorError: R3InjectorError(Standalone[_AppComponent])[_RadioControlRegistry -> _RadioControlRegistry -> _RadioControlRegistry]: 
  NullInjectorError: No provider for _RadioControlRegistry!
    at NullInjector.get (core.mjs:5682:27)
    at R3Injector.get (core.mjs:6125:33)
    at R3Injector.get (core.mjs:6125:33)
    at R3Injector.get (core.mjs:6125:33)
    at ChainedInjector.get (core.mjs:15424:36)
    at lookupTokenUsingModuleInjector (core.mjs:4193:39)
    at getOrCreateInjectable (core.mjs:4241:12)
    at ɵɵdirectiveInject (core.mjs:12042:19)
    at NodeInjectorFactory.RadioControlValueAccessor_Factory [as factory] (forms.mjs:4766:127)
    at getNodeInjectable (core.mjs:4447:44)

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

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 17.1.1
Node: 20.9.0
Package Manager: npm 10.2.3
OS: win32 x64

Angular: 17.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router, ssr

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1701.1
@angular-devkit/build-angular   17.1.1
@angular-devkit/core            17.1.1
@angular-devkit/schematics      17.1.1
@schematics/angular             17.1.1
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.3

Anything else?

No response

JeanMeche added a commit to JeanMeche/angular that referenced this issue Jan 28, 2024
The `RadioControlRegistry` was only provided in a module, providedIn: 'root' fixes that issue.

Fixes angular#54117
@JeanMeche
Copy link
Member

Hi, thanks for taking the time for providing a reproduction.

I believe I have found the root cause and provided a fix in #54130

JeanMeche added a commit to JeanMeche/angular that referenced this issue Jan 28, 2024
The `RadioControlRegistry` was only provided in a module, providedIn: 'root' fixes that issue.

Fixes angular#54117
@jessicajaniuk jessicajaniuk added area: core Issues related to the framework runtime core: defer Issues related to @defer blocks. labels Jan 29, 2024
@ngbot ngbot bot modified the milestone: needsTriage Jan 29, 2024
JeanMeche added a commit to JeanMeche/angular that referenced this issue Jan 29, 2024
The `RadioControlRegistry` was only provided in a module, providedIn: 'root' fixes that issue.

Fixes angular#54117

Co-authored-by: sr5434 <s98775763@gmail.com>
JeanMeche added a commit to JeanMeche/angular that referenced this issue Jan 29, 2024
The `RadioControlRegistry` was only provided in a module, providedIn: 'root' fixes that issue.

Fixes angular#54117

Co-authored-by: sr5434 <s98775763@gmail.com>
JeanMeche added a commit to JeanMeche/angular that referenced this issue Jan 29, 2024
The `RadioControlRegistry` was only provided in a module, providedIn: 'root' fixes that issue.

Fixes angular#54117

Co-authored-by: sr5434 <118690585+sr5434@users.noreply.github.com>
@AndrewKushnir
Copy link
Contributor

As Matthieu mentioned, the app should work correctly once PR #54130 lands. We are also working on an improvement for the @defer feature to resolve an issue described in #52876, which would allow using providers from NgModules imported in standalone components.

@AndrewKushnir AndrewKushnir added the P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent label Jan 29, 2024
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Jan 29, 2024
@alxhub
Copy link
Member

alxhub commented Jan 30, 2024

The root cause of this issue is #52876, so we'll close this as effectively a duplicate.

@alxhub alxhub closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2024
jessicajaniuk pushed a commit that referenced this issue Jan 31, 2024
The `RadioControlRegistry` was only provided in a module, providedIn: 'root' fixes that issue.

Fixes #54117

Co-authored-by: sr5434 <118690585+sr5434@users.noreply.github.com>

PR Close #54130
jessicajaniuk pushed a commit that referenced this issue Jan 31, 2024
The `RadioControlRegistry` was only provided in a module, providedIn: 'root' fixes that issue.

Fixes #54117

Co-authored-by: sr5434 <118690585+sr5434@users.noreply.github.com>

PR Close #54130
@angular-automatic-lock-bot
Copy link

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 Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: core Issues related to the framework runtime core: defer Issues related to @defer blocks. P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants