Hello everyone,
I've been working in Java with Spring/Spring-boot for many years, but I'm pretty new to Angular and I've been trying to explore the tech with a hobby project recently. I've succesfully developped a small website fetching data from my spring-boot backend and displaying them in a hierarchy.
The data contains a few different entities, say a System root for the hierarchy, then under the System, there are a few planets/stars entities. What I'd like to do is to display an info-block depending on the entity clicked on by the user. I've centralized this through an EventService which shows an Entity object (abstract class to the three I mentionned) which can be subscribed to by components. I read about Dynamic Components on the documentation here : https://angular.io/guide/dynamic-component-loader, which gave me enough to put up something that - should - work, and to narrow down the issue to something allowing me to come here for help.
To link Entities to their related EntityInfoComponent (i.e. System to SystemInfoComponent), I've added an abstract field to the Entity class of Type<EntityInfoComponent>, which is then set for every concrete Entity. In the constructor, whenever I call console.log(component), I can succesfully show the relevant component in the console. However, when I try to access it through the component hierarchy using a Directive to insert it via viewContainerRef.createComponent<EntityInfoComponent>, the component field is undefined. There is probably a lifecycle issue I'm not aware of, but I'm a bit lost about what to do to fix the issue.
Does anyone happen to have an idea about it ?