在我的angular2应用程序中,我有两个组件(配置文件/项目),所以我的路线就像 {path:' profile',component:ProfileComponent}, {路径:'项目',组件:ProjectsComponent}
我需要在现有的struts应用程序中集成角度2,其中所有网址都有.do作为网址扩展名
所以我更新了我的路线 {path:' profile.do',component:ProfileComponent}, {path:' projects.do',component:ProjectsComponent}
当我直接使用localhost:3000 / profile.do启动我的应用程序时,我收到了无法获取/profile.do错误
当使用localhost:3000 /启动应用程序时,单击超链接我的配置文件
使用localhost:3000 / profile.do url
访问我的应用程序的任何建议或解决方案答案 0 :(得分:0)
当你点击localhost:3000/profile.do
时,它会直接转到服务器并尝试解析资源,如果未在服务器端设置适当的重定向,则会收到错误消息,说明资源未找到,Angular路由仅在默认页面启动后启动加载,这就是当页面已经加载并且你点击超链接时它可以工作的原因。
在服务器端设置适当的重定向。
希望这会有所帮助!!