Angular 2 routing raising 404 errors

落爺英雄遲暮 提交于 2019-12-04 13:10:19
Bryan

EDIT: IIS Setup for Url Rewriting:

You need to install this to make the following work: http://www.iis.net/downloads/microsoft/url-rewrite

First Step:

Second Step:

I found a link which explains the solution: https://stackoverflow.com/posts/12614072/

OLD:

While running any application built with Angular 2 outside of the development environment setup by npm, you have to replace <base href="/"> with this:

<script>document.write('<base href="' + document.location + '" />');</script>

Note: This is only for production or if running out of the npm environment.

I Think I got my answer after basic understanding on nodejs and use of it with Angular2.

Basically, nodejs - expressjs itself is a web server and when we execute a command npm start web server starts and listing on a port which is defined. And it does not require any additional server.

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