Shared data between Angular componets not displayed after click event
Solution 1:
Use observables instead of getters:
export class SharedService {
private productsCategory: new BehaviorSubject<Array<Product>>([]);
public productsCategory$:Observable<Array<Product>> = this.productsCategory.asObservable()
constructor() { }
setProductCategory(data: Product[]){
this.productsCategory.next(data); }
Subscribe to the public observable in your components