Error during instantiation of AppComponent!.
There is no component directive at element [object Object]
它适用于版本 beta.0:
http://plnkr.co/edit/p6w6bBZfkvXIdDabc1vI?p=preview
它在版本 beta.1 上被破坏了:
http://plnkr.co/edit/3Gn9ZuyMHUdlRqEmqVF7?p=preview
根据突破性变化
Component view is not yet created when component constructor is called. -> use onInit lifecycle callback to access the view of a component
因此,将您的代码移动到ngOnInit
可以正常工作
ngOnInit() {
this.dcl.loadIntoLocation(ChildComponent, this.elementRef, 'child');
}
@ericmartinezr谢谢。
最有用的评论
根据突破性变化
因此,将您的代码移动到
ngOnInit
可以正常工作