将ng-bootstrap中的NGB_ALERT_DIRECTIVES添加到Angular-CLI项目时出错

时间:2016-08-01 12:28:29

标签: angular angular-cli ng-bootstrap

我尝试将ng-bootstrap的警报指令(NGB_ALERT_DIRECTIVES)添加到Angular-CLI项目中。我按照forEach()中描述的步骤进行了操作。

上述结果导致以下错误:

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

如何解决上述问题并且它与预编译选项有关?请参阅:https://stackoverflow.com/a/38413274/1596547

1 个答案:

答案 0 :(得分:0)

问题与角度的版本有关,更新角度到Angular2 RC4解决了它。

在angular-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,问题就解决了。该错误与预编译选项无关。