猿问

angular2在父组件怎么使用双向绑定来接收子组件输出的数据,而不是通过方法呢?

@Input()count:number=5;
@Output()countChange=newEventEmitter();
change{
this.count++;
this.countChange.emit(this.count);
}
[(conut)]="conut"这个会报错
Can'tbindto'conut'sinceitisn'taknownpropertyof'app-child-component'.1.If'app-child-component'isanAngularcomponentandithas'conut'input,thenverifythatitispartofthismodule.2.If'app-child-component'isaWebComponentthenadd'CUSTOM_ELEMENTS_SCHEMA'tothe'@NgModule.schemas'ofthiscomponenttosuppressthismessage.3.Toallowanypropertyadd'NO_ERRORS_SCHEMA'tothe'@NgModule.schemas'ofthiscomponent.
慕丝7291255
浏览 708回答 2
2回答
随时随地看视频慕课网APP

相关分类

JavaScript
我要回答