UPDATE: Thanks to @LoLStats, it is now clear how to properly import pages in such a way that implements lazy loading, see his post here: Ionic 2... now 3... UGH... PLEASE, NEED HELP with Modules
I get that Ionic 3 is still in beta … but with all due respect … it is beginning to feel like we will always be in beta … and our team DESPERATELY would like to get started on a new real world project…
we would LOVE to go with Ionic … but everything continues to change far to rapidly without enough instruction …
We would like to be able to use modules for the purposes of separating out features within our app in that we would like to know that lazy loading is going to work in Ionic …
THE PROBLEM: note, v 3.0.1 is currently set in our package.json file … When generating a new ‘test’ page via the CLI … we get the new test.module.ts file as expected but there is zero instruct on how to instantiate a module within ionic.
We tried the following:
import { TestPageModule } from '../pages/test/test.module'; // new test module generated by the cli
import { MyApp } from './app.component';
@NgModule({
declarations: [MyApp],
imports: [
BrowserModule,
TestPageModule, // i attempt to import it here
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [MyApp],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
Now there is zero instruct on how to set our root page as this new Test Module … attempting to set the module as the root page just throws the following error which obviously needs to be corrected since our new Module is not a component:
No component factory found for TestPageModule. Did you add it to @NgModule.entryComponents?
Why would we add it to entry components? It is not a component … of course attempting to try that anyway also throws an error:
TestPageModule cannot be used as an entry component.
Now i get it … Ionic works differently in that it does not use the Angular router … and it SEEMS like the right approach is just to import the Test page and not the module?? but it is not clear on whats happening here…
So our questions are:
How is lazy loading going to work?
What purpose does this new .module file serve exactly?
And how do we correctly work with modules in Ionic 3? What if we want to create our own?
Guys … ANY HELP every so GREATLY appreciated … UGH… Apologies if i sound frustrated … but this is now the third time we are starting from scratch on a project.