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

时间:2016-09-21 15:01:04

标签: angular ng-bootstrap

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”;

我收到了以下错误。

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);

1 个答案:

答案 0 :(得分:1)

向ng-bootstrap团队报告,这是他们创建问题的一个错误

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