【问题标题】:Code-generation solution for Angular NgRx AppAngular NgRx App 的代码生成解决方案
【发布时间】:2018-12-13 04:11:18
【问题描述】:

我目前正在开发一个 angular-ngrx 应用程序。我正在使用 angular-cli 来搭建应用程序。 我的问题是随着我的应用程序越来越大,我需要添加很多文件,例如 减速器,动作,状态,效果文件。我想自动化这部分,在那里我可以使用一些样板代码生成这些状态管理文件。 我可以请一些帮助开始它吗?

【问题讨论】:

标签: angular webstorm code-generation ngrx angular-schematics


【解决方案1】:
  • 您可以在依赖项中安装@ngrx/schematics,然后通过ng generate 创建新功能的actions/reducers/effects

    https://github.com/ngrx/platform/blob/master/docs/schematics/README.md

  • 如果您使用 WebStorm 最新版本,IDE 可以识别已安装的原理图并让您创建新的actions/reducers/effects

  • WebStorm 的另一个方便的功能是 Live Template,在下面的截图中,我编写了自己的 NgRx 集合:

【讨论】:

    猜你喜欢
    • 2010-10-19
    • 2014-09-07
    • 1970-01-01
    • 1970-01-01
    • 2014-06-13
    • 2018-09-11
    • 1970-01-01
    • 2012-04-06
    • 1970-01-01
    相关资源
    最近更新 更多