2016-10-03 68 views
1

我試圖導入 「ComponentResolver」錯誤與組件進口ComponentResolver(角2)

import { Component, HostListener, ViewContainerRef, ViewChild, ComponentResolver } from '@angular/core'; 

而且我有錯誤:

Module '"/home/maksym/untill/trunk/unTill.Modern/Code/AppRc6/node_modules/@angular/core/index"' has no exported member 'ComponentResolver'.

我的依賴關係:

"@angular/common": "~2.0.1", 
"@angular/compiler": "~2.0.1", 
"@angular/core": "~2.0.1", 
"@angular/forms": "~2.0.1", 
"@angular/http": "~2.0.1", 
"@angular/platform-browser": "~2.0.1", 
"@angular/platform-browser-dynamic": "~2.0.1", 
"@angular/router": "~3.0.1", 
"@angular/upgrade": "~2.0.1", 

我如何解決這個問題?

回答

3

由於RC.6 2.0.0-rc.6 ComponentResolver已被刪除。

每angular2的changelog

使用ComponentFactoryResolver@NgModule.entryComponentsANALYZE_FOR_ENTRY_COMPONENTS提供商動態組件創建在一起。

+0

你使用entryComponents的例子嗎? –

+0

看到這個答案的第一個選項http://stackoverflow.com/questions/39678963/load-existing-components-dynamically-angular-2-final-release/39680765#39680765 – yurzui

+0

謝謝,你真的幫了我! –