Angular ngrx 组件存储 .select 方法
我正在尝试找到 ngrx 的 .select 方法,但我无法在互联网上找到有关它的详细信息。我需要的是找出这个 .select() 方法的重载。就像,最简单的形式是
.select(state => state.someSlice)
“但我也看到了
.select(p1, p2, (p1, p2) => someFunction(p1, p2));
”类似。 p1, p2 一定是可观测量吗?我需要一些关于此的文档。这是我的 package.json 中的 ngrx 版本:
"@ngrx/component-store": "^10.0.0",
I am trying to find the .select method of ngrx but I cannot really find details on it on internet. What I need is to find out about the overloads of this .select() method. Like, the simplest form is
.select(state => state.someSlice)
But I saw also
.select(p1, p2, (p1, p2) => someFunction(p1, p2));
and similar. Is p1, p2 necessarily an observables? I need some documentation on this. This is the ngrx version that is in my package.json:
"@ngrx/component-store": "^10.0.0",
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文档在这方面并不是很好,但区别在于在 v1 中,您只是使用标准地图函数选择该州的某些属性。
但在第二个中,您提供两个选择器,第三个参数是一个映射函数,用于组合这两个选择器的结果。
选择文档位于:https://v10.ngrx.io/api/store/select
但更有用的文档在这里: https://v10.ngrx.io/guide/component-store/read
the documentation isn't great on this, but the difference is in v1 you're just selecting some property of the state with a standard map function.
but in the second, you're feeding two selectors and the third argument is a map function to combine the result of those two selectors.
select docs are here: https://v10.ngrx.io/api/store/select
but the more useful docs are here: https://v10.ngrx.io/guide/component-store/read