I am facing an issue with my Parent Component where two identical Child components are being called. Each child component consists of a SearchForm and Grid.
Both search grids are displayed side by side in iframe format, allowing users to conduct two separate searches simultaneously.
The problem arises when performing a grid search as both components seem to be using the same service, resulting in data population in both grids. This essentially clones the searches.
What can I do to ensure that each child component utilizes a different service instance? The child components are invoked within HTML selectors as shown below:
<div>
<app-product-search-grid></app-product-search-grid>
<app-product-search-grid></app-product-search-grid>
</div>
I am unsure how to implement the solution mentioned in this Stack Overflow answer.
The child component is structured as follows:
export class ProductSearchGridComponent
constructor(
private productGridService: ProductGridService,
If possible, I would like to avoid modifying the constructor as it may impact others' code.