如何安装 ngrx 商店版本 12 以及所有必需的软件包?

发布于 2025-01-13 03:58:22 字数 203 浏览 2 评论 0原文

我需要版本 12,因为当前项目使用 Angular CLI 12。 如果我尝试安装 NGRX,我总是得到版本 13,当我尝试安装版本 12 时,我会丢失效果、动作和其他内容。如何获得正常的ngrx 12?

#Update1

目前我有错误:

找不到模块“@ngrx/store”或其相应类型 声明

I need version 12 because currently project is on angular CLI 12.
If i try to just install NGRX i always getting version 13, when i try install version 12, i missing effects, actions and other stuff. How to get normal ngrx 12?

#Update1

Currently i had error:

Cannot find module '@ngrx/store' or its corresponding type
declarations

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

初见 2025-01-20 03:58:22

对于安装,我从 Angular 6 开始就一直使用 NGRX,并且您始终必须单独安装子模块。在 ngrx 的文档页面中,您将看到这些子模块,单击它们打开您将看到以下链接安装。

子模块

使用 cli6+,如果您需要旧版本,则需要

ng add @ngrx/store@latest
ng add @ngrx/store-devtools@latest
ng add @ngrx/router-store@latest
ng add @ngrx/entity@latest
ng add @ngrx/schematics@latest
ng add @ngrx/component-store@latest

将单词 latest 替换为您需要的版本。 版本参考

请注意,他们分割此内容的原因是让用户可以仅安装您真正需要的部件。因此,建议首先考虑您需要什么,然后添加 NGRX 的该部分。

如果您想使用开发工具,则需要安装 redux devtools 的 chrome 扩展。这在开发中非常方便,因为它存储状态,您可以回滚、查看有效负载、查看操作等...

在此处输入图像描述

如果这只是一个学习项目,您可以安装所有内容。

这是NGRX 文档中提到的示例应用程序

For the installation, I've been using NGRX since angular 6 and you always had to install the submodules separately. In the documentation page of ngrx you'll see these submodules and you click them open you'll see the link for installation.

submodules

With cli6+ you will need to

ng add @ngrx/store@latest
ng add @ngrx/store-devtools@latest
ng add @ngrx/router-store@latest
ng add @ngrx/entity@latest
ng add @ngrx/schematics@latest
ng add @ngrx/component-store@latest

If you need an older version replace the word latest with the version you need. ref for versions

Note that the reason that they split this is so you the user could install only the parts you really need. It's therefor recommended to first think about what you'll need and then add that part of NGRX.

If you want to use the devtools you'll need to install the chrome extension for redux devtools. This is quite handy in development because it stores the state and you can roll back, see payloads, see actions, etc...

enter image description here

If this is just a learning project, you can just install everything.

Here's an example application mentioned in the NGRX documentation.

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