Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/479.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 当使用惰性加载时,ngrx的最佳文件夹结构是什么?_Javascript_Angular_Ngrx - Fatal编程技术网

Javascript 当使用惰性加载时,ngrx的最佳文件夹结构是什么?

Javascript 当使用惰性加载时,ngrx的最佳文件夹结构是什么?,javascript,angular,ngrx,Javascript,Angular,Ngrx,我有一个Angular 6应用程序,其中使用了延迟加载。我的文件夹结构如下所示: src app main products invoices customers suppliers core header footer services core.module.ts shared app-routing.module.ts app.component.ht

我有一个Angular 6应用程序,其中使用了延迟加载。我的文件夹结构如下所示:

src
  app
    main
      products
      invoices
      customers
      suppliers
    core
      header
      footer
      services
      core.module.ts
    shared
    app-routing.module.ts
    app.component.html
    app.component.css
    app.component.spec.ts
    app.component.ts
我遵循了推荐的延迟加载文件夹结构(这里,
main
文件夹下的每个文件夹都是它自己的模块部分)

如果我想合并
ngrx
,我已经看到了关于在哪里包括商店、减速机等的不同意见。我读到的一篇文章说要添加一个
store
文件夹,并在其中包括所有ngrx片段。我读到的另一篇文章说,将ngrx片段添加到每个模块/部分

这里还有另一篇stackoverflow文章:它讨论ngrx文件夹结构,但没有提到延迟加载

当使用延迟加载时,是否有一种推荐的方法来构造ngrx?在每个模块中添加一个包含减缩器、操作等的存储,或者创建一个包含其中所有内容的大型存储文件夹,这更有意义吗?这个应用程序不是太大;它更像是一个中等规模的应用程序


谢谢

绝对将ngrx部件单独添加到每个模块中。它为您提供了一个良好的结构,每个模块都是独立的。此外,每个模块中的ngrx存储也可以延迟加载,因此只有在加载模块时,状态才会出现


此处有更多详细信息:

我们这里有一个建议使用延迟加载的文件夹结构示例:@DeborahK,这是一个很好的示例!谢谢