为什么会出现以下错误:
Can't bind to 'data' since it isn't a known property of 'teach-data'.
尝试:
<teach-data *ngIf="selectedData" [data]="selectedData"></teach-data>
TeachDataComponent
..some imports
export class TeachDataComponent implements OnInit {
public requests;
@Input() data;
constructor(private http: Http, private JwtService:JwtService,
private _service: NotificationsService) {
}
ngOnInit() {
}
*在RC.4中工作
*尝试升级到Angular 2 RC.5后贬值
答案 0 :(得分:1)
确保您已关注所有steps for migrating to RC 5。特别是step 2: Create an NgModule。尝试导入teach-data
组件并将其添加到&#34;声明&#34; @NgModule
陈述的一部分。
答案 1 :(得分:0)
当我尝试在 angular 11.2.11 中将复杂类型从父组件传递到子组件时,我收到了相同的错误消息
我必须添加“数据”的类型:
@Input() data: any;