2016-08-01 60 views
0

我嘗試將ng-bootstrap的alert指令(NGB_ALERT_DIRECTIVES)添加到Angular-CLI項目中。我遵循https://stackoverflow.com/a/38413274/1596547中描述的步驟。將ng-bootstrap中的NGB_ALERT_DIRECTIVES添加到Angular-CLI項目時出錯

前面的結果中出現以下錯誤:

EXCEPTION: Can't resolve all parameters for NgbDismissibleAlert: (TemplateRef, ViewContainerRef, Injector, ?, Renderer). 

如何解決以上,並且這關係到預編譯選項?請參閱:Precompile fails when adding ng-bootstrap to an Angular-CLI project

回答

0

該問題與角度的版本有關,更新角度爲Angular2 RC4解決了它。

在中角CLI的package.json使用下面的依賴關係:

"dependencies": { 
    "@angular/common": "2.0.0-rc.4", 
    "@angular/compiler": "2.0.0-rc.4", 
    "@angular/core": "2.0.0-rc.4", 
    "@angular/forms": "0.2.0", 
    "@angular/http": "2.0.0-rc.4", 
    "@angular/platform-browser": "2.0.0-rc.4", 
    "@angular/platform-browser-dynamic": "2.0.0-rc.4", 
    "@angular/router": "3.0.0-alpha.8", 
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.1", 
    "es6-shim": "0.35.1", 
    "ng2-bootstrap": "^1.0.24", 
    "reflect-metadata": "0.1.3", 
    "rxjs": "5.0.0-beta.6", 
    "systemjs": "0.19.26", 
    "zone.js": "0.6.12" 
    }, 

運行npm update和問題就解決了。該錯誤與預編譯選項無關。

相關問題