0

我尝试将 ng-bootstrap 的警报指令 (NGB_ALERT_DIRECTIVES) 添加到 Angular-CLI 项目中。我按照https://stackoverflow.com/a/38413274/1596547中描述的步骤进行操作。

上述导致以下错误:

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

如何解决上述问题,它与预编译选项有关吗?请参阅:将 ng-bootstrap 添加到 Angular-CLI 项目时预编译失败

4

1 回答 1

0

该问题与 Angular 的版本有关,将 Angular 更新为 Angular2 RC4 解决了它。

package.jsonangular-cli 中使用以下依赖项:

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

于 2016-08-02T21:24:33.140 回答