Is Angular 2's Router broken when using HTML5 routes? [duplicate]

一个人想着一个人 提交于 2019-11-26 22:53:16
Thierry Templier

In fact, it's normal that you have a 404 error when uploading your application since the actual address within the browser is updating (and without # / hashbang approach). By default, HTML5 history is used for reusing in Angular2.

If you want not having a 404 error, you need to update your server to serve the index.html file for each route path.

This link could help you as well: When I refresh my website I get a 404. This is with Angular2 and firebase.

Hope it helps you, Thierry

That's as designed (by HTML5 an not introduced by Angular). Either switch to HashLocationStrategy or use a server that knows how to handle (redirect) such requests. See also https://github.com/angular/angular/issues/4735

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!