Angular Plunker 中的 4.1.0:添加组件 returns 404 XHR 错误

Angular 4.1.0 in Plunker: adding component returns 404 XHR Error

我正在尝试将 Angular 4 与 Plunker 一起使用,但我无法添加新组件。 URL 是: https://plnkr.co/edit/1umcXTeug2o6eiZ89rLl?p=preview

我刚刚用最少的声明创建了一个新组件 - mycomponent.ts。 然后,在 app.ts 中,我添加了导入声明:

import {MyComponent} from "./mycomponent";

并在@NgModule 装饰器的声明数组中添加组件:

 declarations: [ App, MyComponent ],

最后一位破坏了它,returns 出现了 404 XHR 错误。到目前为止,我只是尝试更改导入声明(“./”或不),组件模板的 inline/URL 模板,chrome/firefox 浏览器,但到目前为止没有任何效果。我倾向于认为这是 Plunker 的错 :S

mycomponent.ts 的名称更改为 src/mycomponent.ts 即可。

错误是因为它不能包含组件(路径错误)。

不要忘记将 <combo-compo></combo-compo> 添加到您的 app.ts 模板。

查看: