这是您刷新了您的应用程序时,因为浏览器内的实际地址更新有一个404错误的正常行为(和不#/ hashbang方法)。默认情况下,HTML5历史记录用于在Angular2中重用。
如果您不希望发生404错误,则需要将服务器更新为 ,为您定义的每个路径路径提供index.html文件。
您可以检查此Link如何在Apache上部署Angular应用程序。
如何在Apache处理的index.html
This can be achieved by adding a .htaccess file (in the same directory where the index.html resides) with the following contents.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase/
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
</IfModule>
所有你需要做的是改变你的apache .htaccess文件,使所有的请求服务index.html的外商投资企业。进一步的路由由加载的角色脚本完成。 –