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

createComponent results in #44790

Closed
jbistis opened this issue Jan 22, 2022 · 5 comments
Closed

createComponent results in #44790

jbistis opened this issue Jan 22, 2022 · 5 comments
Labels
area: core Issues related to the framework runtime core: di
Milestone

Comments

@jbistis
Copy link

jbistis commented Jan 22, 2022

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

forms

Is this a regression?

Yes

Description

Error: NG0201: No provider for FormContainerComponent found in NodeInjector...when trying to use the createComponent.

Please provide a link to a minimal reproduction of the bug

https://github.com/prometheus-partners/form-issue.git

Please provide the exception or error you saw

Error: NG0201: No provider for FormContainerComponent found in NodeInjector. Find more at https://angular.io/errors/NG0201

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

Angular CLI: 13.1.2
Node: 14.18.2
Package Manager: npm 6.14.15
OS: darwin x64

Angular: 13.1.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1301.2
@angular-devkit/build-angular   13.1.2
@angular-devkit/core            13.1.2
@angular-devkit/schematics      13.1.2
@angular/cli                    13.1.2
@angular/fire                   6.1.5
@angular/google-maps            13.1.3
@schematics/angular             13.1.2
rxjs                            6.6.7
typescript                      4.5.4

Anything else?

To recreate the issue, simply serve the app and try to view in the browser and the error will appear. This configuration works for us in angular 9.1.15.

@JoostK
Copy link
Member

JoostK commented Jan 23, 2022

It looks like the issue here is with the usage of @Host() as injection flag for FormFieldComponent in InputNumberComponent. The @Host() injection flag used to be ignored for dynamically created components, but Ivy properly adheres to that flag. This is noted in the Ivy compatibility guide:

If a token is injected with the @Host or @Self flag, the module injector is not searched for that token (previously, tokens marked with these flags would still search at the module level).

@jbistis
Copy link
Author

jbistis commented Jan 23, 2022

Thanks, I will review. I made an a13 version so you do not have to deal with the This is a simple server for use in testing or debugging Angular limitations in console.log. a13 version is at https://github.com/prometheus-partners/input-fields.git

@ngbot ngbot bot added this to the needsTriage milestone Jan 24, 2022
@jbistis
Copy link
Author

jbistis commented Jan 24, 2022

Thanks. I also read #31539 which seems related. Code is still not functioning as intended. Will provide an update shortly.

@ngbot ngbot bot modified the milestone: needsTriage Feb 1, 2022
@JoostK JoostK added the area: core Issues related to the framework runtime label Feb 1, 2022
@ngbot ngbot bot added this to the needsTriage milestone Feb 1, 2022
@JoostK
Copy link
Member

JoostK commented May 27, 2022

Closing per #44790 (comment).

@JoostK JoostK closed this as completed May 27, 2022
@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 Jun 27, 2022
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: di
Projects
None yet
Development

No branches or pull requests

3 participants