Angular2最终版本ng-bootstrap组件找不到404



angular2最终版本。Ng-bootstrap alpha v.5

bootstrap组件在html上工作,但是当我试图像下面这样导入它们时

import {ViewChild} from "@angular/core/src/metadata/di";
import {NgbDropdown} from "@ng-bootstrap/ng-bootstrap/dropdown/dropdown”;

i got following error.

zone.js:136drainMicroTaskQueue @ zone.js:368ZoneTask.invoke @ zone.js:308
zone.js:1274 GET http://localhost:8080/abc/node_modules/@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js/dropdown/dropdown.js 404 (Not Found)

显然看起来像是试图从不存在的bundle中加载下拉列表。Bundle只包含ng-bootstrap.js 'dropdown'是Bundle外的另一个组件。我想systemjs.config.js有什么问题,有人能帮忙吗?

我的systemjs.config.js文件

(function (global) {
  System.config({
    paths: {
      // paths serve as alias
      'npm:': 'node_modules/'
    },
    // map tells the System loader where to look for things
    map: {
      // our app is within the app folder
      app: 'app',
      // angular bundles
      '@angular/core': 'npm:@angular/core/bundles/core.umd.js',
      '@angular/common': 'npm:@angular/common/bundles/common.umd.js',
      '@angular/compiler': 'npm:@angular/compiler/bundles/compiler.umd.js',
      '@angular/platform-browser': 'npm:@angular/platform-browser/bundles/platform-browser.umd.js',
      '@angular/platform-browser-dynamic': 'npm:@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js',
      '@angular/http': 'npm:@angular/http/bundles/http.umd.js',
      '@angular/router': 'npm:@angular/router/bundles/router.umd.js',
      '@angular/forms': 'npm:@angular/forms/bundles/forms.umd.js',
      'rxjs':                       'npm:rxjs',
      'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
      '@ng-bootstrap/ng-bootstrap':'npm:@ng-bootstrap/ng-bootstrap/bundles/ng-bootstrap.js',
    },
    // packages tells the System loader how to load when no filename and/or no extension
    packages: {
      app: {
        main: './main.js',
        defaultExtension: 'js'
      },
      rxjs: {
        defaultExtension: 'js'
      },
      'angular2-in-memory-web-api': {
        main: './index.js',
        defaultExtension: 'js'
      },
      '@ng-bootstrap':{
        defaultExtension: 'js'
      },
      '@ng-bootstrap/ng-bootstrap':{
        defaultExtension: 'js'
      }
    }
  });
})(this);

向ng-bootstrap团队报告,这是一个bug,他们创建了一个问题

https://github.com/ng-bootstrap/ng-bootstrap/issues/779

最新更新