Provide a service to find component by name
See original GitHub issue🚀 feature request
Relevant Package
This feature request is for @angular/coreDescription
I have a scenario in my framework that I should find ComponentType by it’s name and then create it. In Angular 8 I used ComponentFactoryResolver["_factories"]
to find component.
(Component added to EntryComponent
)
But in Ivy there is no _factories
in ComponentFactoryResolver
.
I tried to use _r3Injector.injectorDefTypes
and then ["ɵmod"].declarations
for each module. It was OK in development but in production mode declarations is always empty.
After that I tried to use directiveRegistry of TView . But I understood that only components stay on directiveRegistry that used.
Describe the solution you’d like
I think it would be nice if there is a service that metadata of modules and components can be accessible via it.Describe alternatives you’ve considered
An alternative can be provide a service to register these types and then use them.Issue Analytics
- State:
- Created 4 years ago
- Reactions:21
- Comments:29 (10 by maintainers)
Top Results From Across the Web
How to get component name from service in Angular without ...
How to get component name from service in Angular without using private API like view container ref · 1. constructor.name is not giving...
Read more >Rendering dynamic components by selector name in Ivy
Angular gives us the mechanism to render components dynamically through View Container using ComponentFactory. To do this, we need to know ...
Read more >Solved: Getting the component name in code
Solved: We're trying to address a bunch of accessibility issues, one in particular is proving quite difficult. We need to supply for=""
Read more >How to get the class (component's) name in angular. - Medium
Recently i've encountered a problem where i wanted to have a list of different reusable “dynamic” components nested in a wrapper component ......
Read more >Angular components overview
Run the ng generate component <component-name> command, where <component-name> is the name of your new component. By default, this command creates the ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Can we get a solution for this in Angular Ivy? It’s a much required feature I feel.
We are using a way to have dynamic components by extending modules to provide components that should be available via selectors. Hope this helps.
https://indepth.dev/posts/1400/components-by-selector-name-angular