Reputation: 2841
I've been trying to load angular2-ui-switch into my application .but i've been getting an error as follows:
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
I have follwed all the instructions given in the readme. The link to the module is : https://www.npmjs.com/package/angular2-ui-switch
my systemjs.config.js is :
/**
* 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);
What am i doing wrong ? Thanks in advance
Upvotes: 1
Views: 426
Reputation: 691
You didn't add the module to your systemjs.config.js I guess
Add this in the map:
'angular2-ui-switch': 'npm:angular2-ui-switch'
And in packages:
'angular2-ui-switch': {
main: 'node_modules/angular2-ui-swith-main-class-to-find'
defaultExtension: 'js',
}
Upvotes: 2