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

Ability to provide ngModuleRef when creating component #494

Closed
msgoloborodov opened this issue Jan 23, 2023 · 4 comments
Closed

Ability to provide ngModuleRef when creating component #494

msgoloborodov opened this issue Jan 23, 2023 · 4 comments

Comments

@msgoloborodov
Copy link
Contributor

msgoloborodov commented Jan 23, 2023

Can you add ability to provide ngModuleRef or environmentInjector to ViewContainerRef.createComponent options:
https://angular.io/api/core/ViewContainerRef#createComponent
ngModuleRef: an NgModuleRef of the component's NgModule, you should almost always provide this to ensure that all expected providers are available for the component instantiation.
It is very important when creating component declared in lazy loaded module to properly resolving dependencies.

@gund
Copy link
Owner

gund commented Jan 23, 2023

If you are using ngComponentOutlet directive from Angular you already can provide NgModule there.

Or are you talking about ndc-dynamic component from this library specifically?

@msgoloborodov
Copy link
Contributor Author

Yes. I'm talking about ndc-dynamic.
#495

@msgoloborodov
Copy link
Contributor Author

If you are using ngComponentOutlet directive from Angular you already can provide NgModule there.

Or are you talking about ndc-dynamic component from this library specifically?

You are right. I think it's better to use ngComponentOutlet and ndcDynamicInputs/ndcDynamicOutputs if needed.

@gund
Copy link
Owner

gund commented Jan 25, 2023

This has been released in #495 and available in v10.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants