Angular core module error

Asked

Viewed 285 times

1

I am implementing the CORE module but is giving error: ERROR : Unexpected value 'Coremodule in C:/dev/master/src/app/core/core.module.ts' Imported by the module 'Appmodule in C:/dev/migracao-radios/novo/master/src/app/app.modulets'. Please add a @Ngmodule Annotation.

//app module.

import { BrowserModule } from "@angular/platform-browser";
import { NgModule, LOCALE_ID } from "@angular/core";

import { AppRoutingModule } from "./app-routing.module";
import { AppComponent } from "./app.component";

import { PLATFORM_ID, APP_ID, Inject } from "@angular/core";
import { isPlatformBrowser, DatePipe } from "@angular/common";
import { FooterComponent } from "./components/footer/footer.component";
import { PlayerComponent } from "./components/player/player.component";
import { HeaderComponent } from "./components/header/header.component";
import { HeaderBandComponent } from "./components/header-band/header-band.component";
import { SharedModule } from "./shared/shared.module";
import { CoreModule } from "./core/core.module";
import { HttpModule } from "@angular/http";

@NgModule({
  declarations: [
    AppComponent,
    HeaderComponent,
    HeaderBandComponent,
    FooterComponent,
    PlayerComponent
  ],
  imports: [
    BrowserModule.withServerTransition({ appId: "Radios" }),
    AppRoutingModule,
    HttpModule,
    SharedModule,
    CoreModule
  ],
  providers: [{ provide: LOCALE_ID, useValue: "pt-BR" }],
  bootstrap: [AppComponent]
})
export class AppModule {
  constructor(
    @Inject(PLATFORM_ID) private platformId: Object,
    @Inject(APP_ID) private appId: string
  ) {
    const platform = isPlatformBrowser(platformId)
      ? "in the browser"
      : "on the server";
    console.log(`Running ${platform} with appId=${appId}`);
  }
}

//core module.

import { NgModule } from "@angular/core";

import { ColumnistService } from "../services/columnist.service";
import { AlertService } from "../services/alert.service";
import { FormService } from "../services/form.service";
import { HttpUtilService } from "../services/http-util.service";
import { LiveService } from "../services/live.service";
import { NewsService } from "../services/news.service";
import { PlayerService } from "../services/player.service";
import { PodcastService } from "../services/podcast.service";
import { ProgramsService } from "../services/programs.service";
import { RadioService } from "../services/radio.service";
import { SchedulerService } from "../services/scheduler.service";
import { SportService } from "../services/sport.service";
import { TeamService } from "../services/team.service";

NgModule({
  providers: [
    ColumnistService,
    AlertService,
    FormService,
    HttpUtilService,
    LiveService,
    NewsService,
    PlayerService,
    PodcastService,
    ProgramsService,
    RadioService,
    SchedulerService,
    SportService,
    TeamService
  ]
});
export class CoreModule {}

1 answer

0


Is missing the @ in Annotation NgModule. Follow the correct code:

import { NgModule } from "@angular/core";

import { ColumnistService } from "../services/columnist.service";
import { AlertService } from "../services/alert.service";
import { FormService } from "../services/form.service";
import { HttpUtilService } from "../services/http-util.service";
import { LiveService } from "../services/live.service";
import { NewsService } from "../services/news.service";
import { PlayerService } from "../services/player.service";
import { PodcastService } from "../services/podcast.service";
import { ProgramsService } from "../services/programs.service";
import { RadioService } from "../services/radio.service";
import { SchedulerService } from "../services/scheduler.service";
import { SportService } from "../services/sport.service";
import { TeamService } from "../services/team.service";

@NgModule({
  providers: [
    ColumnistService,
    AlertService,
    FormService,
    HttpUtilService,
    LiveService,
    NewsService,
    PlayerService,
    PodcastService,
    ProgramsService,
    RadioService,
    SchedulerService,
    SportService,
    TeamService
  ]
});
export class CoreModule {}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.