Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular 2 routing only works in ng serve but not http server #5

Open
vishal1997 opened this issue Oct 9, 2017 · 0 comments
Open

Angular 2 routing only works in ng serve but not http server #5

vishal1997 opened this issue Oct 9, 2017 · 0 comments

Comments

@vishal1997
Copy link
Contributor

vishal1997 commented Oct 9, 2017

For production I need to use http server instead of ng serve. But the routing is not working with http server, the same was working with ng serve.
Tried to solve this problem by implementing HashLocationStrategy which adds # to the routes by adding HashLocationStrategy to AppModule providers.

       providers: [{provide: LocationStrategy, useClass: HashLocationStrategy}],

and added the corresponding import
import { HashLocationStrategy, LocationStrategy } from '@angular/common';

But this didn't solved the problem only the root URL works, cannot navigate into other links.

@vishal1997 vishal1997 changed the title Angular 2 routing only works in ng serve but not nodemon Angular 2 routing only works in ng serve but not http server Oct 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant