Angular ngrx 组件存储 .select 方法

发布于 2025-01-18 00:31:45 字数 376 浏览 3 评论 0原文

我正在尝试找到 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

永言不败 2025-01-25 00:31:45

文档在这方面并不是很好,但区别在于在 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文