Piping Inside A Subscribe In Ngrx
I have a selector that takes a parameter to filter values. The parameter depends on an observable's return. export class LineSynopticComponent implements OnInit, AfterViewInit { s
Solution 1:
Let's change your observable setup like this:
ngOninit(){
this.selectedData$.pipe(
switchMap((elm) => {
returnthis.store.pipe(select(selectSchedulingsTimes, { time: elm.timeSelect }));
})
).subscribe((resposeFromStore) => {
//Do whatever you want tot do with the store valueconsole.log(resposeFromStore);
})
}
You need not subscribe on selectedData$
and then set up your other observable.
Hope it helps.
Solution 2:
I think your selector is the problem. You should read this, its giving some good example and it also contains a section regarding dynamic parameters. Thats what I would try:
exportconst selectSchedulingsTimes = createSelector(
schedulings,
schedule =>(time: string) => {
let nowFormat = moment(time, 'HH:mm');
return state.schedulings.data.filter(elm => {
...
return elm
});
}
);
Post a Comment for "Piping Inside A Subscribe In Ngrx"