That's a browser feature. Angular by default uses HTML5 pushstate (PathLocationStrategy in Angular slang). You either need a server that processes all requests like it were requesting `index.html` or you switch to `HashLocationStrategy` (with # in the URL for routes) https://angular.io/docs/js/latest/api/router/HashLocationStrategy-class.html
On Friday, January 15, 2016 at 3:44:45 PM UTC+1, HansMeise wrote: > > My SPA starts with something like http://localhost:3000/dist/dev which is > mangement by the MainComponent. From there i can navigate to other > components by clicking on buttons with routerLinks. So looking up a list of > orders would show the childroute http://localhost:3000/dist/dev/orders > <http://localhost:3000/dist/dev/orders/42> which leads to loading the > OrdersComponent. Furthermore clicking an order leads to the next childroute > http://localhost:3000/dist/dev/orders/42 > which shows the orders and the details of order 42. > <http://localhost:3000/dist/dev/orders/42> > > Now the problem: If I reload the page with the url > http://localhost:3000/dist/dev/orders/42 everything is fine and the order > list + the order detail is shown. But If I reload > http://localhost:3000/dist/dev/orders > <http://localhost:3000/dist/dev/orders/42> the router doesn't recognize > the path and will only show the page, that would be shown if only > http://localhost:3000/dist/dev > <http://www.google.com/url?q=http%3A%2F%2Flocalhost%3A3000%2Fdist%2Fdev&sa=D&sntz=1&usg=AFQjCNEZTjfoOC0JjOziia66ILRz5DU44Q> > > was in the url, thus only loading the MainComponent and not the expected > OrdersComponent. Any idea how to fix this? > > Btw. I already fixed the "Cannot GET ..." error with redirecting all > requests to the index.html: > > server.get('*', function(req, res, next) { > res.sendFile(process.cwd() + APP_BASE + APP_DEST + '/index.html'); > }); > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
