Angular: DynamicComponentLoaderloadIntoLocationが2.0.0.beta.1で正しく機能していません

作成日 2016年01月11日  ·  3コメント  ·  ソース: angular/angular

 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');
    }

全てのコメント3件

重大な変更によると

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ありがとう。

この問題は、非アクティブのために自動的にロックされています。
同様の問題または関連する問題が発生した場合は、新しい問題を提出してください。

自動会話ロックポリシーの詳細をご覧ください。

_このアクションはボットによって自動的に実行されました。_

このページは役に立ちましたか?
0 / 5 - 0 評価