I have a question about Angular2 + (not AngularJs). I'm a Vue.js programmer and I'm curious if it's possible in Angular.
Imagine that you have an application with many modules that perform many tasks. You have a frontend application responsible for monitoring module states; displaying logs, errors, informing the user that some modules have finished work, etc. The modules talk to the frontend via WebSocket (or STOMP). If the message is received by frontend, it must be processed and the corresponding state of the module must be updated (e.g. Title). So if Angular received the message, he must dynamically select the child component and update its state (call children method).
This is how it looks in Vue.js:
Content of the parent component:
<module ref="moduleA" ></module>
<module ref="moduleB" ></module>
<module ref="moduleC" ></module>
The parent is responsible for handling the WebSocket (or STOMP) communication. On the new message he executes the following code:
const message = JSON.parse(messageFromBackend);
const moduleName = message["module"]; // message["module"] is for example 'moduleB'
this.$refs[moduleName].updateTitle(message["title"]);
So, when Parent receive message, he dynamically select the appropriate child (he knows which one is right from the backend (message ["module"]) ), and then update module state.
Is it possible in Angular?