I have a Home component where I retrieved the user information, I would like to send certain fields of this user to another page.
Now I am doing it by URL in such a way:
<a [routerLink]="['/greenhouse', green._id, green.id_estacion]" [routerLinkActive]="['active']">
<img src="assets/img/a.jpg" width="100" height="100" alt="">
</a>
But I would like to pass more parameters without using the URL like now.
I have been looking at the input and output but I don't quite understand how to use them in this case, since I only see communication between parents and children.
Could you give me any clue?
All the best.
For the communication between components of the same level a service is used, the use of service is part of the good practices of Angular, in addition to being very useful for cases like this, it is also customary to leave all http communications within the service.
The creation of services may seem like a lot of work, but once you understand how they work, writing them will be very simple and you will see the usefulness of them to organize your project.
The content to follow is a bit long, but we recommend you read it and try to understand it well.
Below an example of how to create services, integrate them to your component and module
Finally the only thing left is to declare the service as a provider in the module