Signup for the Ionic Newsletter to get the latest news and updates!

  • Gary

    How might one package up the modules as an npm installable module? A tutorial on this topic would be great.

    • Reinhard Riedl

      Indeed! I am also trying to reuse modules in different apps

    • zixia

      I had just published a very simple npm installable NgModule last week which is very simple: only contains one component(one html tag). I use it in my ionic 2 app without any problem.

      You might like to have a look at: https://github.com/chatie/angular

    • http://janpiotrowski.de/ Jan Piotrowski

      There exists a module template from Ionic: https://github.com/driftyco/ionic-module-template But of course the README is a bit sparse, an example would be great.

  • Vijith

    Is there any specific reason you want to stick with all components, pages etc loaded in a single module on the second approach. From an application design standpoint the feature module design from Angular (https://angular.io/docs/ts/latest/guide/ngmodule.html#!#feature-modules) seems to be very much beneficial. Also the feature modules could be lazy loaded.

  • Bernhard Obermoser

    Now with Lazy Loading,
    is it possible to lazy load plugins also?

    Because right now i have to load all the plugins in the app.module.ts if i’m right?

    Can i load plugins just in the components in which i Need them?

    • Cyberto

      As far as I know every module can be lazy loaded. so if you import modules in your app module they will be lazy loaded. And if you have plugins in your sub-modules they should be too

      • Bernhard Obermoser

        so i don’t need to import all plugins in my app.module.ts?
        Gonna give it a try 😀

        • Bernhard Obermoser

          🙁 Does not work…have to import them in app.module.ts and add to the providers.
          is there a way of not having to do that? like with lazy loaded pages?

  • Loomy Narty

    Hey nice article, but I cant lazy load the components. I have exactly the same code you have, the only solution is calling:

    IonicPageModule.forChild(MusicCardComponent)

    in the imports array then it is working…Any ideas why?

  • Fabio Berger

    Finally a good explanation on how to work with multiple modules with Ionic’s Lazy Loading. It helped me a LOT. Thanks!

  • Kim Wong

    The reason why ionic lazy loading is bad.
    http://roblouie.com/article/456/ionic-3s-lazy-loading-is-bad/

  • Sebastian Ovide

    using the method 2, how do you use a component inside another component ?

  • David Harel

    Can you please recommend a solution to bundle sets of pages?
    As I see it, typically I have many master/details sets of pages and also sets of “wizard” pages. Seems to me it would make sense to create modules for each set.

    Thanks.

  • Francisco Vieira

    I need to know where I can find documentation of how to create and use Directives in Ionic v2/v3.
    Actually I need to understand also about Components and the difference between them and directives. Not sure yet how they work on this Ionic (in Ionic v1 I used a lot of my own directives).