2016-07-12 6 views
5

私のAngular 2アプリケーションをbeta.14のrc.4にアップグレードしています。角度2 rc4:DynamicComponentLoaderは非推奨です

@ angular/coreのDynamicComponentLoaderで廃止予定の警告が表示されます。

使用する新しいクラスは何ですか? 利用可能な例がありますか?

+0

を*それはDynamicComponentLoader'は廃止され、 '」と言うコミットからこのhttp://stackoverflow.com/a/37044960/1679310* –

+1

をチェックし、' ComponentResolver'と 'ViewContainerRef'を使用してください。直接。" https://github.com/angular/angular/commit/5297c9d9ccc6f8831d1656915e3d78e767022517 例http://plnkr.co/edit/8o9dAcOQ4LTYa4Oms5wE?p=preview – jtzero

+1

より良い例:https://github.com/PulpoWork/angular2-inner -content/blob/master/src/inner-content.ts – jtzero

答えて

3

廃止予定です。代わりにComponentResolverが使用されます。このリンクAngular 2 dynamic tabs with user-click chosen componentsの最初の答えを参照してください。

すぎて、これを参照してください:http://blog.lacolaco.net/post/dynamic-component-creation-in-angular-2/

+0

ComponentResolverも削除されました。 https://github.com/angular/angular/commit/73a9ee4 –

+0

他の代替手段はありますか? –

+1

この回答はあなたを助けるかもしれないhttp://stackoverflow.com/questions/38888008/how-can-i-use-create-dynamic-template-to-compile-dynamic-component-with-angular – monica