I need to transfer data from one component to another, I found only a way to do this with route parameters in url:
So, I have this configuration for the target component in the router:
{
path: 'edit-tags/:type/:name/:id',
component: EditTagsComponent,
},
And I use it like this from another component:
this.router.navigate([`../edit-tags/${product.type}/${product.name}/${product.id}`], { relativeTo: this.route });
It works fine, but I don’t want to show idin the url and also pass some data to the component.
I also saw the use of such configurations in the router:
{ path: 'test-product', component: ProductsContentComponent, data: { role: 'admin', type: 'test-product' } }
But I did not find an example of using the same approach inside another component.
So, is there a way to pass some data from component to component when routing without reflecting it in the url?