我一直在尝试将angular2-ui-switch加载到我的应用程序中。但是我收到的错误如下:
Error: XHR error (404 Not Found) loading http://localhost:3000/angular2-ui-switch
at XMLHttpRequest.wrapFn [as _onreadystatechange] (http://localhost:3000/node_modules/zone.js/dist/zone.js:698:29)
at ZoneDelegate.invokeTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:265:35)
at Zone.runTask (http://localhost:3000/node_modules/zone.js/dist/zone.js:154:47)
at XMLHttpRequest.ZoneTask.invoke (http://localhost:3000/node_modules/zone.js/dist/zone.js:335:33)
Error loading http://localhost:3000/angular2-ui-switch as "angular2-ui-switch" from http://localhost:3000/app/app.module.js
(anonymous) @ ?buIds=fidelity-BlrEGL,demo-ETS:33
ZoneDelegate.invoke @ zone.js:232
Zone.run @ zone.js:114
(anonymous) @ zone.js:502
ZoneDelegate.invokeTask @ zone.js:265
Zone.runTask @ zone.js:154
drainMicroTaskQueue @ zone.js:401
ZoneTask.invoke @ zone.js:339
我已经阅读了自述文件中给出的所有说明。 该模块的链接是:https://www.npmjs.com/package/angular2-ui-switch
我的systemjs.config.js是:
/**
* System configuration for Angular 2 samples
* Adjust as necessary for your application needs.
*/
(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
'moment': 'npm:moment' ,
app: 'app',
'mydatepicker': 'npm:mydatepicker',
'angular-2-dropdown-multiselect/src/multiselect-dropdown':'npm:angular-2-dropdown-multiselect/src/multiselect-dropdown',
// 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',
// other libraries
'rxjs': 'npm:rxjs',
'angular2-in-memory-web-api': 'npm:angular2-in-memory-web-api',
'angular2-google-maps': 'npm:angular2-google-maps',
},
// 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'
},
'angular2-google-maps':{
main: './index.js',
defaultExtension: 'js'
},
mydatepicker: {
defaultExtension: 'js'
},
'angular-2-dropdown-multiselect/src/multiselect-dropdown':{
main:'../multiselect-dropdown',
defaultExtension:'js'
},
'moment': 'node_modules/moment/moment.js',
'ng2-bootstrap/ng2-bootstrap': 'node_modules/ng2-bootstrap/bundles/ng2-bootstrap.umd.js',
moment: { main: './moment.js', defaultExtension: 'js' },
}
});
})(this);
我做错了什么? 提前致谢
答案 0 :(得分:2)
您没有将模块添加到systemjs.config.js我想
在地图中添加:
'angular2-ui-switch': {
main: 'node_modules/angular2-ui-swith-main-class-to-find'
defaultExtension: 'js',
}
在包裹中:
{{1}}