NullInjectorError: No provider for Content!


#1

I am migrating my ionic 3 app to ionic 4. Here is my ng --version output:

Angular CLI: 7.0.6
Node: 9.11.2
OS: linux x64
Angular: 7.0.4
… common, compiler, compiler-cli, core, forms, http
… language-service, platform-browser, platform-browser-dynamic
… router

Package Version

@angular-devkit/architect 0.10.6
@angular-devkit/build-angular 0.10.6
@angular-devkit/build-optimizer 0.10.6
@angular-devkit/build-webpack 0.10.6
@angular-devkit/core 7.0.6
@angular-devkit/schematics 7.0.6
@angular/cli 7.0.6
@ngtools/webpack 7.0.6
@schematics/angular 7.0.6
@schematics/update 0.10.6
rxjs 6.3.3
typescript 3.1.6
webpack 4.19.1

I have tried all options that have been suggested, which mostly happen to be app.module.ts.
Below is my app.module


@NgModule({
  declarations: [AppComponent, ListComponent, ItemListComponent],
  entryComponents: [],
  imports: [
    BrowserModule,
    FormsModule,
    HttpClientModule,
    IonicModule.forRoot(),
    AppRoutingModule,
    IonicStorageModule.forRoot({
      name: "__mydb",
      driverOrder: ["indexeddb", "sqlite", "websql"]
    })
  ],
  providers: [
    StatusBar,
    SplashScreen,
    { provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
     ],
  bootstrap: [AppComponent]
})
export class AppModule {}

Have been trying all options for ages, what am I missing?
Here is the Error message:

AppComponent_Host.ngfactory.js? [sm]:1 ERROR Error: StaticInjectorError(AppModule)[AppComponent -> Content]: 
  StaticInjectorError(Platform: core)[AppComponent -> Content]: 
    NullInjectorError: No provider for Content!

#2

Presumably you have added a Content parameter to your AppComponent's constructor. Why?


#3

You’re right. Thank you for pinpointing the source of the error. I am suspecting that you’re one of the builders of ionic.

I added content to set the root component in a function as ;
this.content.setRoot(page.component)
I’ve realized that I don’t need it.

One more problem though, when I click on login option of my menu, the url updates but the contents of login page does not display. No errors displayed

          <ion-menu-toggle auto-hide="false" *ngFor="let p of pages">
            <ion-item [routerDirection]="'forward'" [routerLink]="[p.url]">
              <ion-icon slot="start" [name]="p.icon"></ion-icon>
              <ion-label> {{ p.title }} </ion-label>
            </ion-item>
          </ion-menu-toggle>

What could be the reason? html page of the login page is basically a login form.