I am looking to pass the object retrieved by my service using
serviceName.setObject(myObject: object)
, enabling me to access that object from another component and utilize its data for display. Specifically, I want to obtain a Character Object when a user selects it in a NameComponent
, so I can then reference it in my StatisticsComponent
to showcase the character's statistics, such as {{ myCharacter.name }}
. While still getting acquainted with Angular, I initially thought that I could easily find the solution through some research, but it appears more challenging than expected.
In my most recent attempt, I managed to receive an Observable of my Object and successfully output all the necessary data to the console using the method below:
this.myService.getAllInfosById(this.getPersonnageIdByName(change))
.subscribe(response => {
console.log("All Details of Personnage", response);
});
Although I believe the subscribe function is crucial for updating, I would greatly appreciate assistance from the community on this matter. Thank you in advance.