angular2 最终版本。ng-bootstrap alpha v.5
引导组件适用于 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)
当然看起来它正在尝试从不存在的捆绑包中加载下拉列表。捆绑包只包含 ng-bootstrap.js 'dropdown' 是捆绑包之外的不同组件。我认为它与 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);