我在商店中有以下数据:
{
properties :
[
{
_id: 123.
name: "Nice property"
},
{
_id: 456.
name: "Another nice property"
}
]
}
在我的ngOnInit
方法中,我想从商店中选择一个属性来计算一个作为 queryParam 传递的 id,如下所示:
javascript
this.id = this.route.snapshot.paramMap.get('id');
this.property = this.ngRedux.select( state => state.properties).pipe(find( property => property._id === this.id))
显然,这不起作用,但它抓住了我想要做的事情的精神。
使用 ngRedux 通过 id 进行谷歌搜索几乎没有带来什么,所以我怀疑我这样做是错误的。
但是,我尝试使用 解决此问题.subscribe
,然后所有逻辑都必须在订阅回调中,这似乎是错误的,并且在我尝试制作反应式表单时不起作用。