模块 'AppModule' 声明的意外模块 'Ng2SmartTableModule'

Unexpected module 'Ng2SmartTableModule' declared by the module 'AppModule'

我正在尝试从这个 link 中学习 ng2 smart table,但我遇到了这个错误。

未捕获错误:意外的模块 'Ng2SmartTableModule' 由模块 'AppModule' 声明。请添加@Pipe/@Directive/@Component 注解。

这是app.component.ts

import { Component } from '@angular/core';

@Component({
  selector: 'app-root',
  //templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'],
  //template: `<ng2-smart-table [settings]="settings"></ng2-smart-table>`
})
export class AppComponent {
  //title = 'app';
  settings = {
    columns: {
      id: {
        title: 'ID'
      },
      name: {
        title: 'Full Name'
      },
      username: {
        title: 'User Name'
      },
      email: {
        title: 'Email'
      }
    }
  };
}

还有 app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { Ng2SmartTableModule } from 'ng2-smart-table';

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

@NgModule({
  declarations: [
    AppComponent,
    Ng2SmartTableModule
  ],
  imports: [
    BrowserModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

谁能帮我解决这个错误?

提前致谢。

因为是一个模块,需要在imports里面加上,不是在declarations[=下面13=]

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

@NgModule({
  declarations: [
    AppComponent

  ],
  imports: [
    BrowserModule,
    Ng2SmartTableModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }