Ich versuche, DashboardPage in der Datei app.module.ts als freigegebenes Modul zu verwenden, in dem ich Fehler wie "Fehler: Unerwartete Anweisung 'DashboardPage' durch das Modul 'SharedModule' importiert. Bitte hinzufügen eine Annotation @NgModule. "Fehler: Unerwartete Direktive 'DashboardPage' vom Modul 'SharedModule' importiert. Fügen Sie eine Annotation @NgModule hinzu
Geben Sie einige Vorschläge zur Lösung dieses Problems. Danke im Voraus.
Unterhalb der Codes,
app.module.ts
import {NgModule, ErrorHandler} from '@angular/core';
import {BrowserModule} from '@angular/platform-browser';
import {HttpModule} from '@angular/http';
import {IonicApp, IonicModule, IonicErrorHandler, IonicPageModule} from 'ionic-angular';
import {MyApp} from './app.component';
import {DatePickerModule} from 'datepicker-ionic2';
import {IonicStorageModule} from '@ionic/storage';
import {PreloadImageModule} from '../components/preload-image/preload-image.module';
import {ShowHidePasswordModule} from "../components/show-hide-password/show-hide-password.module";
import {Login} from '../pages/login/login';
import {DashboardPage} from '../pages/dashboard/dashboard';
import {SharedModule} from '../app/shared/shared-module';
import {PROVIDERS} from '../app/shared/dashboard';
@NgModule({
declarations: [
MyApp,
Login,
],
imports: [
BrowserModule,
HttpModule,
IonicModule.forRoot(MyApp, {
platforms: {
ios: {
autoFocusAssist: 'instant'
}
}
}),
IonicStorageModule.forRoot(),
DatePickerModule,
SharedModule,
IonicPageModule.forChild(Login), PreloadImageModule, ShowHidePasswordModule,
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
Login,
],
providers: [
PROVIDERS,
{provide: ErrorHandler, useClass: IonicErrorHandler},
]
})
export class AppModule {
}
Shared-module.ts Datei
import {NgModule} from '@angular/core';
import {CommonModule} from "@angular/common";
import {PROVIDERS} from "../shared/dashboard";
import {DashboardPage} from "../../pages/dashboard/dashboard";
@NgModule({
declarations: [
PROVIDERS
],
imports: [
CommonModule,
DashboardPage,
],
exports: [
DashboardPage,
]
})
export class SharedModule {
}