IonicModule parameters and multiple custom modules


#1

My main AppModule has recently grown significantly so I want to cut it into multiple smaller modules. In a first step, I took a number of login / registration components and placed them in LoginModule:

import { NgModule } from '@angular/core';
import { IonicModule } from 'ionic-angular';

(...)

@NgModule({
  declarations: [
    (...)
  ],
  entryComponents: [
    (...)  
  ]
})
export class LoginModule {}

Next, I’ve imported this module in AppModule adding it to imports list. Unfortunately it doesn’t work. I get a number of compilation errors like:

Can't bind to 'navPush' since it isn't a known property of 'button'.

It seems that IonicModule is a mandatory thing to include in all modules. If I add IonicModule to imports in my LoginModule everything works fine. OK, this is reasonable. I have one question about it, thought.

In my AppModule I provide a number of parameters to IonicModule:

  imports: [
    IonicModule.forRoot(MyApp, {
      mode: 'ios',
      tabsPlacement: 'bottom'
    }),
    LoginModule
  ],

should I also repeat all those parameters in LoginModule ?

Or is it enough to do just imports: [IonicModule] there?

I know that latter compiles and works but isn’t it possible that lack of IonicModule parameters can have an impact on LoginModule compilation unit? For example if mode: "ios" is not included there?


#2

yes, I am interested in this approach as well. Thanks!