是否有一些示例可以在一个命令中在 Angular 7 上创建 ngrx/Store

Posted

技术标签:

【中文标题】是否有一些示例可以在一个命令中在 Angular 7 上创建 ngrx/Store【英文标题】:Is there some example to create ngrx/Store on Angular 7 in one command 【发布时间】:2019-11-13 06:39:22 【问题描述】:

我正在创建新的 Web 仪表板并使用 ngrx/store 在 Angular 7 中加载和数据。大约第三次我正在为不同的商店界面创建和生成文件,并且它似乎不会在这里停止。所以我想知道是否有一些 cli 包可以在一个命令行中为模块创建存储。

我每次都最好使用 cli 来创建动作、效果、减速器、状态。我尝试了一些来自 cli 的解决方案,但它只创建了 reducer 和 index.ts。

npm install @ngrx/schematics --save-dev
npm install @ngrx/store,effects,entity,store-devtools --save
ng config cli.defaultCollection @ngrx/schematics
ng generate @ngrx/schematics:store State --root --module some-app.module.ts -d

【问题讨论】:

【参考方案1】:

可能是ng update 命令,例如https://ngrx.io/guide/store/install#installing-with-ng-add

ng add @ngrx/store

这将安装 @ngrx/store 并做一个最小的脚手架来帮助你开始。

【讨论】:

谢谢,。但我没有安装它的问题,我已经在使用 store 并且我创建了 store 和 ngrx。问题是我创建商店捆绑文件(效果、商店、动作、减速器)太多次。我想知道是否有一些带有参数的 CLI,例如 ng generate @ngrx/schematics:store MyStore --root --module some-app.module.ts -d --action --effects --state --selectors 或类似的东西 我认为在一行中没有这样的命令可以生成所有这些动作、效果等。您需要使用单独的命令。请参阅ngrx.io/guide/schematics 文档。

以上是关于是否有一些示例可以在一个命令中在 Angular 7 上创建 ngrx/Store的主要内容,如果未能解决你的问题,请参考以下文章

如何在构建命令中在Gradle上添加运行时库

Angular http post 仅在 Chrome 中在服务器上返回 403 错误

linux 中在终端输入yes ok命令表示啥意思

Linux中在当前目录下查找某个文件。

Angular 2 Http 获取响应示例

是否可以在Twig中在布局文件中设置自动窗口策略