0
I would like to know, if I can inject a component into another component, I have a function within a component and when I go to do something into another component, I would like to call that function the other component. I know there is an Eventemitter, but I would like to know if any mistakes can happen. Here I managed to do the function of the other component and, it is executed perfectly, but I do not know if the use of this can bring some future error. I used @Injectable() in the component I’d like to use in the other component.
Dude, what exactly do you want to do? it is better to use eventEmmiter, injectable should be used for services and not components pq components are visual and services are not. Maybe you’d better put that method of yours into a service and inject it into the two components.
– Eduardo Vargas
put the code of what you’re trying to do.
– Eduardo Vargas
So it worked out what I wanted to do. I was also thinking of using Eventemmiter with a service, but I tried injecting the component into another one and it worked. What I wanted to know is if this could bring any future problems.
– Edson Camargo
Face is terrible this and totally not the role of a component.
– Eduardo Vargas