在 Angular 2 Style Guide 中,有一个目录结构的建议:https ://angular.io/docs/ts/latest/guide/style-guide.html#04-06
我通常认为这是一个很好的建议,我打算自己做一些非常相似的事情。但是,我遇到了一个问题,我很好奇是否有人解决了它。
请注意,该heroes
模块包含一个shared
带有heroes-button.component
. 大概,我们希望在整个应用程序中使用这个组件(因此,“共享”)。
同样,该villains
模块包含一个shared
带有villains-button.component
.
如果我想在模块和模块中的某个地方使用,那么villains-button.component
我最终会得到一个循环引用。heroes
heroes-button.component
villains
简而言之:Angular 不允许我将 ModuleA 导入 ModuleB,并将 ModuleB 导入 ModuleA,但样式指南另有说明。
有人对这种情况有任何解决方案吗?