Angular 角度2项目中的错误&x27;意外声明

Angular 角度2项目中的错误&x27;意外声明,angular,typescript,Angular,Typescript,我正在angular2.0中做一个项目。在app.module文件中声明组件时出现错误。 我无法识别出哪里出了问题,我正在使用VS code进行编码 错误如下- dashboard:20 Error: (SystemJS) Unexpected value 'HeroDesignComponent' declared by the module 'AppModule' Error: Unexpected value 'HeroDesignComponent' declared by the m

我正在
angular2.0
中做一个项目。在
app.module
文件中声明组件时出现错误。 我无法识别出哪里出了问题,我正在使用
VS code
进行编码

错误如下-

dashboard:20 Error: (SystemJS) Unexpected value 'HeroDesignComponent' declared by the module 'AppModule'

Error: Unexpected value 'HeroDesignComponent' declared by the module 'AppModule'
        at eval 

(http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14725:29)
        at Array.forEach (native)
        at CompileMetadataResolver._loadNgModuleMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14702:56)
        at CompileMetadataResolver.loadNgModuleMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14625:31)
        at RuntimeCompiler._loadModules (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17420:43)
        at RuntimeCompiler._compileModuleAndComponents (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17390:37)
        at RuntimeCompiler.compileModuleAsync (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17380:23)
        at PlatformRef_._bootstrapModuleWithZone (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6454:29)
        at PlatformRef_.bootstrapModule (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6436:25)
        at Object.eval (http://localhost:3000/app/main.js:4:53)
    Evaluating http://localhost:3000/app/main.js
    Error loading http://localhost:3000/app/main.js
        at eval (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14725:29)
        at Array.forEach (native)
        at CompileMetadataResolver._loadNgModuleMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14702:56)
        at CompileMetadataResolver.loadNgModuleMetadata (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:14625:31)
        at RuntimeCompiler._loadModules (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17420:43)
        at RuntimeCompiler._compileModuleAndComponents (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17390:37)
        at RuntimeCompiler.compileModuleAsync (http://localhost:3000/node_modules/@angular/compiler/bundles/compiler.umd.js:17380:23)
        at PlatformRef_._bootstrapModuleWithZone (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6454:29)
        at PlatformRef_.bootstrapModule (http://localhost:3000/node_modules/@angular/core/bundles/core.umd.js:6436:25)
        at Object.eval (http://localhost:3000/app/main.js:4:53)
    Evaluating http://localhost:3000/app/main.js
    Error loading http://localhost:3000/app/main.js
请帮我做这件事

hero-design.component.ts

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

  @Component({
       moduleId: module.id,
       selector : 'my-design',
       templateUrl : 'hero-design.component.html',
       styleUrls : ['hero-design.component.css']
  })

 export class HeroDesignComponent{

 subjects = ['Appointment', 'Interview', 'regarding a post'];

 model =new  hero1(1,'Tony','tony@gmail.com','9988776655',this.subjects[0]);

 submitted = false;

 onsubmit() { this.submitted = true }

 newhero1() {
 this.model = new hero1(1,'','','','');
 }
}
app.module.ts

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

import { AppComponent }        from './app.component';
import { HeroDetailComponent } from './hero-detail.component';
import { HeroesComponent }     from './heroes.component';
import { HeroDesignComponent } from './hero-design.component';
import { HeroService }         from './Hero.service';
import { DashboardComponent }  from './dashboard.component';
import { AppRoutingModule }    from './app-routing.module';


@NgModule({ 
  imports:      [ 
    BrowserModule,
    FormsModule,
    AppRoutingModule
    ],

  declarations: [ 
    AppComponent,
    DashboardComponent,
    HeroDetailComponent,
    HeroesComponent,
    HeroDesignComponent
    ],

   providers:[
     HeroService
   ],

  bootstrap:    [ 
    AppComponent 
   ]
})

export class AppModule { }

如果您不共享相关代码,我们如何知道问题出在哪里?共享您的应用程序模块文件代码请提供特定的角度和网页版本。而且,这可能会对你有所帮助