Ionic error in app.module.ts

Hello , i had a problem with app.module.ts when i tried page navigation
please help me to make it work!

type or paste code he
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';

import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';

import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { HomePage } from './home/home.page';
import { InscriptionPage } from './inscription/inscription.page';
import { ConnectionPage } from './connection/connection.page';
import { AdminInscrirePage } from './admin-inscrire/admin-inscrire.page';

@NgModule({
  declarations: [
    AppComponent,
    HomePage,
    InscriptionPage,
    ConnectionPage,
    AdminInscrirePage
  ],
  imports: [
    BrowserModule,
    IonicModule.forRoot(),
    AppComponent,
    HomePage,
    InscriptionPage,
    ConnectionPage,
    AdminInscrirePage

  ],

  entryComponents: [
    AppComponent,
    HomePage,
    ConnectionPage,
    AdminInscrirePage

  ],
  providers: [
    StatusBar,
    SplashScreen,
  { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
  ]
})
export class AppModule {}
re

here the screen capture of errors

i am really comfused about what should i correct
help me please
the pages files link in GitHub : https://github.com/faresbenslama95/IOnic.git

home.page.ts :

import { Component } from '@angular/core';
import { NavController } from '@ionic/angular';
import {InscriptionPage} from '../inscription/inscription.page';
import {ConnectionPage} from '../connection/connection.page';
import {AdminInscrirePage} from '../admin-inscrire/admin-inscrire.page';
import { ConnectionPage } from './connection/connection.page';
import { AdminInscrirePage } from './admin-inscrire/admin-inscrire.page';

@Component({
  selector: 'app-home',
  templateUrl: 'home.page.html',
  styleUrls: ['home.page.scss'],
})
export class HomePage {

constructor(public navCtrl: NavController) {

}

onGoToInscrire() {
this.navCtrl.push(InscriptionPage);
}

onGoToConnecter() {
this.navCtrl.push(ConnectionPage);
}

onGoToAdminInscrire() {
this.navCtrl.push(AdminInscrirePage);
}


}

Change your app.module.ts as follows:
@NgModule({
declarations: [
AppComponent,
HomePage,
InscriptionPage,
ConnectionPage,
AdminInscrirePage
],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppComponent,
],

entryComponents: [
AppComponent,
],
providers: [
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
]
})
export class AppModule {}

Hi ,
It had not worked

Your home.page.ts import the ConnectionPage and AdminInscrirePage twice ! ( lines 4 = line5, and line 5 = line 7 )

1 Like