On the Angular 2 Style Guide, there is a recommendation for a directory structure: https://angular.io/docs/ts/latest/guide/style-guide.html#04-06
I generally think it's a good recommendation, I'd intend on doing something very similar myself. However, I've run into an issue with it, and I'm curious if anyone has resolved it.
Notice the heroes
module contains a shared
directory with a heroes-button.component
. Presumably, we'll want to use this component all over the app (hence, "shared").
Likewise, the villains
module contains a shared
directory with a villains-button.component
.
If I want to use the villains-button.component
in some place in the heroes
module and the heroes-button.component
in the villains
module, then I'm going to end up with a circular reference.
In short: Angular doesn't allow me to import a ModuleA into ModuleB, AND ModuleB into ModuleA, but the style guide indicates otherwise.
Does anyone have any solutions for this scenario?