类型src / app / createreportcomponent component.ts是2个模块的声明的一部分错误,但正常的开发版本运行良好。如何解决错误
****应用模块ts文件****
import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { AngularDualListBoxModule } from 'angular-dual-listbox';
import { HomeComponent } from './home/home.component';
import { CreatereportComponent } from './createreport/createreport.component';
import { AppRoutingModule } from './app-routing.module';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { HashLocationStrategy, LocationStrategy } from '@angular/common';
import { HttpModule } from '@angular/http';
import { Angular2CsvModule } from 'angular2-csv';
// import {ToastModule} from 'ng2-toastr/ng2-toastr';
import { CommonService } from './services/common.service';
@NgModule({
declarations: [
AppComponent,
HomeComponent,
CreatereportComponent
],
imports: [
BrowserModule,
AngularDualListBoxModule,
BrowserAnimationsModule,
AppRoutingModule,
HttpModule,
FormsModule,
Angular2CsvModule,
// ToastModule.forRoot(),
],
providers: [{provide: LocationStrategy, useClass: HashLocationStrategy},CommonService],
bootstrap: [AppComponent]
})
export class AppModule { }
创建组件ts文件
答案 0 :(得分:0)
如果在另一个模块中使用'createreportcomponent',则将其从主模块中删除。