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 ?