I can not use a module

0

I'm trying to use a module and I'm not getting this error below:

Uncaught Error: Unexpected directive 'BordaCreateComponent' imported by the module 'AppModule'. Please add a @NgModule annotation. at syntaxError

My App.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppRoutingModule } from './app-routing.module';

import { AppComponent } from './app.component';

import { UsuarioRoutingModule } from './usuario/usuario-routing.module';
import { UsuarioModule } from './usuario/usuario.module';
import { UsuarioLoginComponent } from './usuario/usuario-login/usuario-login.component';

import { BordaCreateComponent } from './borda/borda-create/borda-create.component';

import { FormsModule, ReactiveFormsModule } from '@angular/forms';

import {HttpModule} from '@angular/http';

import {NgbModule} from '@ng-bootstrap/ng-bootstrap';


@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    FormsModule,
    ReactiveFormsModule,
    HttpModule,
    NgbModule.forRoot(),
    BordaCreateComponent
  ],
  exports: [
    AppComponent,
    FormsModule,
    ReactiveFormsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

My Edge.module.ts

import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';

import { AppModule } from '../app.module';
import { BordaRoutingModule } from './borda-routing.module';
import { BordaListComponent } from './borda-list/borda-list.component';
import { BordaCreateComponent } from './borda-create/borda-create.component';

@NgModule({
  imports: [
    CommonModule,
    BordaRoutingModule,
    AppModule
   ],
  exports: [
    BordaCreateComponent,
    BordaListComponent
   ],
  declarations: [BordaCreateComponent, BordaListComponent]
})
export class BordaModule { }
    
asked by anonymous 11.01.2018 / 04:04

1 answer

1

Within NgModule.imports , you can list only modules, not components:

imports: [
    BrowserModule,
    AppRoutingModule,
    FormsModule,
    ReactiveFormsModule,
    HttpModule,
    NgbModule.forRoot(),
    BordaCreateComponent // <----- errado
]

Remove the reference BordaCreateComponente and refer to the BordaModulo module. Additionally, read about what should be imported into the NgModules FAQ . An excerpt from the documentation (translated by me):

  

What should I import?

     

Import% of% whose public declarable (exported) classes you need to reference in the component models of this module.

    
11.01.2018 / 12:20