Angular2输出Eventemitter仅适用于Plunkr,但在使用本地副本时不起作用

时间:2016-10-12 06:29:25

标签: angular

我一直在使用plunkr尝试这个angular2示例Component Interaction并且它工作正常,但是如果我使用visual studio 2015 / Code并且下载所有包(node_modules)不能正常工作,我有附上样本本地副本,第一个"同意/不同意"只有第二个/第三个正在工作时,emit才能正常工作。

以下是我的代码副本:SampleApplication

希望有人能帮助我,谢谢。

1 个答案:

答案 0 :(得分:1)

对不起,大家已经知道问题出在哪里了。

它是我的模块声明,我应该删除bootstrap中的votercomponent

@NgModule({
    imports: [BrowserModule],
    declarations: [VoteTakerComponent, VoterComponent],
    bootstrap: [VoteTakerComponent, VoterComponent]
})

export class AppModule { }