I have come over to the community to find some wisdom. I have currently migrated my project from angular 12 to angular 19.
To that end I want to maintain a map or dictionary of components which I would use to render these components dynamically via a service which gets the type of the component based on the string key provided and renders it via view container ref.
const componentMap = {
"comp1": Component1,
"comp2": Component2,
}
But in keeping the map of components I run into obvious circular dependency DI/compile time issues. It worked fine with angular 12 and I know its poor code. So now I was scouring the web for maintaining a map/dictionary of component types/ component references which can then be used with viewContainerRef to render component. I could not find any best practises for doing that. Hence I am here to ask for help from the community and gain some knowledge in the process. Thanks for the help in advance.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744250956a4565164.html
评论列表(0条)