I am trying to filter a store subscription based on route params, but something about my syntax is not correct. I am trying to pipe the params down so the filter
rxjs operator can filter the store the store based on the params:
selectedData;
@select(['data', 'selectedData']) selectedData$: Observable<any>;
ngOnInit() {
this.route.params
.pipe(params => {
return params
}), switchMap(params => {
this.selectedData$.pipe(filter(data => data.question === params))
}).subscribe(data => this.selectedData = data);
}
It says the params argument to switchMap()
is of the wrong type...what is going wrong?