Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 从商店中选择的7个过滤器项目_Angular_Rxjs_Observable - Fatal编程技术网

Angular 从商店中选择的7个过滤器项目

Angular 从商店中选择的7个过滤器项目,angular,rxjs,observable,Angular,Rxjs,Observable,在我的组件中,我从商店订阅了: @Select(AccountsState.getAccounts) items$: Observable<any>; 但是不起作用。你能给我一些建议吗你能试试下面的代码吗 this.items$.pipe( filter(item => item.m === filterValue) ) 您的filterValue可能不会触发从此.items$重新提交列表。因此,您可能可以将filterValue转换为Subject,然后使用comb

在我的组件中,我从商店订阅了:

 @Select(AccountsState.getAccounts) items$: Observable<any>;

但是不起作用。你能给我一些建议吗你能试试下面的代码吗

this.items$.pipe(
  filter(item => item.m === filterValue)
)

您的
filterValue
可能不会触发从此.items$重新提交列表。因此,您可能可以将
filterValue
转换为Subject,然后使用
combinelatetest
是否应该是
this.items$.pipe(filter(item=>item.m==filterValue)
?并且最有可能是
this.items$.pipe(map(items=>items.filter(item==filterValue)))
@Kos我认为它接近成功,因为我收到一个数组作为下一个值,我无法迭代它。这不起作用,但我会调查它。@Nick1R11,好吧,您仍然需要解决@martin提到的问题。用于合并最新的
项$
和您的
过滤器值更改$
(例如,请参阅反应式表单值更改)。因此,最终您将得到类似于
filtered$=combinelateTest(items$,filterValue$,(items,filterValue)=>items.filter(item.m==filterValue))
this.items$.pipe(
  filter(item => item.m === filterValue)
)