Angularjs 为什么zonejs在angular 2.4的typescript中找不到我的组件

Angularjs 为什么zonejs在angular 2.4的typescript中找不到我的组件,angularjs,typescript,zonejs,Angularjs,Typescript,Zonejs,我有一个角度2.45项目写在打字脚本。我在我的应用程序的路由模块中添加了一个新组件,并导入了新组件 启动应用程序时,我收到以下错误: Unhandled Promise rejection: Component NewComponent is not part of any NgModule or the module has not been imported into your module. ; Zone: <root> ; Task: Promise.then ; Value

我有一个角度2.45项目写在打字脚本。我在我的应用程序的路由模块中添加了一个新组件,并导入了新组件

启动应用程序时,我收到以下错误:

Unhandled Promise rejection: Component NewComponent is not part of any NgModule or the module has not been imported into your module. ; Zone: <root> ; Task: Promise.then ; Value: ZoneAwareError Error: Component NewComponent is not part of any NgModule or the module has not been imported into your module.
    at new Error (native)
    at JitCompiler._createCompiledHostTemplate (http://localhost:3000/static/src/assets/js/lib/@angular/compiler/bundles/compiler.umd.js:27482:23) [<root>]
    at eval (http://localhost:3000/static/src/assets/js/lib/@angular/compiler/bundles/compiler.umd.js:27448:41) [<root>]
    at Array.forEach (native) [<root>]
    at eval (http://localhost:3000/static/src/assets/js/lib/@angular/compiler/bundles/compiler.umd.js:27446:49) [<root>]
    at Array.forEach (native) [<root>]
    at JitCompiler._compileComponents (http://localhost:3000/static/src/assets/js/lib/@angular/compiler/bundles/compiler.umd.js:27435:47) [<root>]
    at createResult (http://localhost:3000/static/src/assets/js/lib/@angular/compiler/bundles/compiler.umd.js:27333:23) [<root>]
    at Zone.run (http://localhost:3000/static/src/assets/js/lib/zone.js/dist/zone.js:113:43) [<root> => <root>]
    at http://localhost:3000/static/src/assets/js/lib/zone.js/dist/zone.js:535:57 [<root>]
    at Zone.runTask (http://localhost:3000/static/src/assets/js/lib/zone.js/dist/zone.js:151:47) [<root> => <root>]
    at drainMicroTaskQueue (http://localhost:3000/static/src/assets/js/lib/zone.js/dist/zone.js:433:35) [<root>]
ZoneAwareError
在我的AppModule中,我将组件和RoutingModule添加到AppModule的声明和导入数组中

@NgModule({
  imports: [
    ...,
    AppRoutingModule,
],
declarations: [
    ....,
    NewComponent
],
bootstrap: [AppComponent]
)}
export class AppModule {}
对于我的所有其他组件,这完全符合预期。Angular找到组件,注入所需的所有内容并正确布线


然而,新组件根本不起作用。知道原因是什么吗?

我发现了错误。我把新组件的导入搞错了。我在到组件的路径中有一个太多的斜杠

import { NewComponent } from './components//new.component';
vs

typescript编译器(命令行和VisualStudio代码上的版本2.15)并不在意。Zonejs/angular似乎很在意

import { NewComponent } from './components//new.component';
import { NewComponent } from './components/new.component';