This question is also on stackoverflow: https://stackoverflow.com/questions/44912488/angular2-ionic2-circular-dependent-modules-because-of-navigation-between-pages
I was refactoring my project to match the Angular2 styleguide at https://angular.io/guide/styleguide At first I had one module so there was no problem. Now while refactoring and with splitting into modules I got circular dependencies because of the navigation between pages of different modules.
Simplified, I have three modules, each having components:
Shops each import
BookListItemComponent shows a book title, and when tapped navigates to the
BookComponent which show the book’s details.
ShopListComponent shows a list of books of a certain shop.
Books module imports the
Shared module to use the spinner etc. this creates a circular dependency. How are we supposed to solve this?
In an app you navigate between pages of different modules. I don’t see a way to avoid having these pointing at each other. Especially with the BookListItemComponent which is used all over the app to list books.
I have pages like:
- Top100 of books
- List of publishers of which the detail page shows a list of books
- Book shops listing books
- Profile page of user with list of their books
If I need to merge all components navigating to a book I end up in having one single app module again.
I have also looked at:
- Ionic2 navigation & circular depencies
But couldn’t really map this to my problem.