Question
Why cant I refresh on my routed page without getting errors?
Problem
I got an onSelect
in my <navigation>
directive and try to load my PageComponent
into the <router-outlet>
. This actually works, you can see that my page is loaded when you click the test navigation link.
In my real code, if I click on it, the url changes to http://localhost:3000/page/10
(10 is just some id, not relevant). If I refresh now on the page I get the errors.
it seems like it searches the .js files on the wrong path /page/node_modules
instead of /node_modules/
Errors
GET http://localhost:3000/page/style.css
GET http://localhost:3000/page/vendor.js
GET http://localhost:3000/page/node_modules/es6-shim/es6-shim.min.js
GET http://localhost:3000/page/node_modules/systemjs/dist/system-polyfills.js
GET http://localhost:3000/page/node_modules/angular2/bundles/angular2-polyfills.js
GET http://localhost:3000/page/node_modules/systemjs/dist/system.src.js
GET http://localhost:3000/page/node_modules/angular2/bundles/angular2.dev.js
GET http://localhost:3000/page/node_modules/rxjs/bundles/Rx.js
GET http://localhost:3000/page/node_modules/angular2/bundles/http.dev.js
GET http://localhost:3000/page/node_modules/angular2/bundles/router.dev.js
Uncaught ReferenceError: System is not defined
Setup
I tried to set my example up on plunkr. But I guess you cant really refresh there to test my error exactly.