1

Estou implementando o modulo CORE mas fica dando erro: ERROR in : 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.module.ts'. 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

1 Resposta 1

0

Está faltando o @ no annotation NgModule. Segue o código correto:

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 {}

Você deve fazer log-in para responder a esta pergunta.

Esta não é a resposta que você está procurando? Pesquise outras perguntas com a tag .