Property 'forChild' does not exist on type 'typeof IonicModule'

后端 未结 1 1365
遥遥无期
遥遥无期 2021-02-05 10:20

I\'m using the ionic cli to generate the page using this command

ionic generate page login
ionic g page login

then i get this error in browser<

相关标签:
1条回答
  • 2021-02-05 11:16

    There is

    IonicModule.forRoot(MyApp).

    Github link here.

    export class IonicModule {
    
    /**
     * Set the root app component for you IonicModule
     * @param {any} appRoot The root AppComponent for this app.
     * @param {any} config Config Options for the app. Accepts any config property.
     * @param {any} deepLinkConfig Any configuration needed for the Ionic Deeplinker.
     */
     static forRoot(appRoot: any,  
                    config: any = null, 
                    deepLinkConfig: DeepLinkConfig = null): ModuleWithProviders {
    

    For bootstrapping a single page you could try IonicPageModule.

    @NgModule({
       imports: [IonicModule],
       exports: [IonicModule]
    })
    export class IonicPageModule {
    
       static forChild(page: any): ModuleWithProviders {
    

    Change your import to :

     imports: [
        IonicPageModule.forChild(Login),
      ]
    

    Update:

    Relevant links:IonicPage, IonicPageModule.

    According to the google docs shared in discussion here this is introduced in ionic 3 for lazy loading of ionic pages.

    0 讨论(0)
提交回复
热议问题