I have one component (Component A - All books) that triggers a route to another component (Component B - Selected Book) on a click event like so:
selectedItem(details){
this.router.navigate(['/book', details.id]);
}
What I'm trying to accomplish is pass the selected book details to Component B when the click event in Component A is executed.
I know we can use the Input() decorator to pass data from Parent to Child component in Angular. But that wouldn't work here since I'm not explicitly writing the Component B inside A like: <component-b></component-b>
In my case should I use a shared service to pass data around?
I'd also like to know some examples that can be considered as a parent-child relationship. In this book example, can books and selected book be considered a parent/child relationship? I've made some small Angular projects and I've always struggled with the concept.