I have a two components whith a shared service and the service is connected to an NGRX Data store. The Button-Component
triggers a request via the service by calling the getByKey()
method of NGRX-Data. The Display-Component
has an Observable which is subscribed with the async pipe.
// Observable subscribed with async pipe
identifiers$: Observable<Identifiers> = new Observable<Identifiers>();
// Method called by the `Button-Component`
callApi(key) {
// When this emits I want to map the value to `identifiers$`
this.service.getByKey(key);
}
So far I'm not able to trigger the call with the Subscrption in the Display-Component
. It works if I manually subscribe in the Service and the entities$
in the Store are updated too. I could use that but then I need some logic to store the key
which I would like to avoid.
So how can I map from the Observable returned by the Store to the one of the Display-Component
in one go?