I would like to know if it’s possible to use the Angular 2 modular architecture (a root App module and feature modules - https://angular.io/docs/ts/latest/guide/ngmodule.html) in Ionic 2 app. The default Ionic 2 app architecture is different (pages, providers and theme directories) and I wonder if it can be changed to a modular application architecture with multiple feature modules, containing components, services, directives and pipes.
It would be great if someone from the Ionic team could write a blog post about it or make a sample application with modular architecture. I am sure it would be very useful for larger mobile applications, as the modular architecture scales much better and is the recommended way to build Angular 2 applications.
Thanks for the answer. So what would you suggest for a well structured ionic app ? Do you have some exemples ?
Should we just have one root module and all the other pages as components ?
That’s a rather complicated question at the moment. Generally, I would say “yes”, especially if you have custom components that are included in multiple pages. If, instead, you have a lot of completely independent pages, lazily loading them might be a win for you.
Are you sure about that? I think a lot of Angular’s module structure relies on the Angular router, which is not feature compatible with the Ionic navigation system.