Im neuen Ionic Seite erstellen Name für listing
und im hinzugefügt einige Datei seinen Namen listing.service.ts
nachdem ich diese listing
Seite öffnen kann ich nichtFehler: Uncaught (in Versprechen): Fehler: Kein Anbieter für - ionische 3
Error: Uncaught (in promise): Error: No provider for ListingService!
Error: No provider for ListingService!
einige Fehler hatte
Ich versuche, es für mehr als eine Stunde zu reparieren, aber kann keine Lösungen finden, wie man es repariert? Dank Dies ist mein Code
listing.module.ts
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { ListingPage } from './listing';
import {ListingService} from "./listing.service";
@NgModule({
declarations: [
ListingPage,
],
imports: [
IonicPageModule.forChild(ListingPage),
],
providers: [
ListingService
]
})
export class ListingPageModule {}
listing.service.ts
import {Injectable} from '@angular/core';
@Injectable()
export class ListingService {
private eventMap:any;
constructor() {
this.initEventMap();
}
app.module.ts
import {ListingService} from "../pages/listing/listing.service";
const providers = [ ListingService ];
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
CalendarModule, // Ionic Calendar
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}
Warum haben Sie 'const providers = [ListingService];' in app.module.ts? –
Sir im hinzugefügt Listing Seite zu listing.service.ts nachdem ich const Provider = [ListingService] hinzugefügt; – core114