i have following error when trying start angular2 application:
failed load resource: server responded status of 404 (not found) angular2-polyfills.js:332 error: error: xhr error (404 not found) loading http://localhost:55707/rxjs(…)
here index.html:
<!doctype html> <html> <head> <base href="/"> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>streak maker</title> <link rel="icon" type="image/png" href="/images/favicon.png" /> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" /> <!-- ie required polyfills, in exact order --> <script src="node_modules/es6-shim/es6-shim.min.js"></script> <script src="node_modules/systemjs/dist/system-polyfills.js"></script> <script src="node_modules/angular2/es6/dev/src/testing/shims_for_ie.js"></script> <script src="node_modules/angular2/bundles/angular2-polyfills.js"></script> <script src="node_modules/systemjs/dist/system.src.js"></script> <script src="node_modules/rxjs/bundles/rx.js"></script> <script src="node_modules/angular2/bundles/angular2.dev.js"></script> <script src="node_modules/angular2/bundles/router.js"></script> <script src="node_modules/angular2/bundles/http.dev.js"></script> <script src="https://code.jquery.com/jquery-2.2.0.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script> <script> system.config({ packages: { app: { format: 'register', defaultextension: 'js' }, }, }); system.import('app/boot') .then(null, console.error.bind(console)); </script> </head> <body> <app>loading...</app> </body> </html>
boot.ts:
///<reference path="../node_modules/angular2/typings/browser.d.ts"/> import {app} './app.component'; import {bootstrap} 'angular2/platform/browser'; import {router_providers} 'angular2/router'; import {http_providers} 'angular2/http'; import {app_providers} './app.module'; bootstrap(app, [ //router_providers, //http_providers, app_providers]);
i've tried putting paths rxjs in system.config (it doesn't work) since i'm using rxjs bundle shouldn't have that.
the problem in streak-maker/src/streakmaker.web/app/message-board/message-board.service.ts
file
you should import rxjs
module since doesn't exist in rxjs library:
import {http} 'angular2/http'; import {injectable} 'angular2/core'; import "rxjs"; // <----- @injectable() export class messageboardservice { constructor(private _http: http) { } get() { return this._http.get('/api/messageboard').map(res => { return res.json(); }); } }
you should use following 1 (rxjs/rx
) instead:
import {http} 'angular2/http'; import {injectable} 'angular2/core'; import "rxjs/rx"; // <----- @injectable() export class messageboardservice { (...) }
you're right: include rx.js file enough provide rxjs modules. no additional (explicit) configuration required within systemjs.config
.
Comments
Post a Comment