Angular 角度布线在分布中不起作用

Angular 角度布线在分布中不起作用,angular,angular-ui-router,Angular,Angular Ui Router,角度路由在节点服务器ie.npm start上运行良好,但在ng build--prod之后在Xampp中部署文件时不起作用 const路由:路由=[ {path:,组件:HomeComponent}, {路径:“分站”,组件:HomeComponent}, {路径:“本地”,组件:HomeComponent}, {路径:“术语”,组件:TermsComponent}, {路径:“隐私政策”,组件:隐私政策组件}, {路径:“选择车”,组件:SelectCarComponent}, {路径:“选

角度路由在节点服务器ie.npm start上运行良好,但在ng build--prod之后在Xampp中部署文件时不起作用

const路由:路由=[
{path:,组件:HomeComponent},
{路径:“分站”,组件:HomeComponent},
{路径:“本地”,组件:HomeComponent},
{路径:“术语”,组件:TermsComponent},
{路径:“隐私政策”,组件:隐私政策组件},
{路径:“选择车”,组件:SelectCarComponent},
{路径:“选择车”,组件:SelectCarComponent},
{路径:“新闻发布”,组件:新闻发布组件},
{路径:“帐户”,组件:AccountSettingComponent},
{路径:“注销”,组件:LogoutComponent},
{路径:“**”,组件:PageNotFoundComponent},
]

空路径路由
{path:,component:HomeComponent},
不带子级的路由应使用
pathMatch:'true'
。我假设您的服务器未配置为支持HTML5 pushState。您可以尝试切换到HashLocationStrategy并检查它是否以这种方式工作。这将证实我的建议(imports:[RouterModule.forRoot(myRoutes,{useHash:true})]`@GünterZöchbauer现在路由工作,我如何删除uri中的#?通过删除
,useHash:true
-),我建议这样做只是为了找到根本原因。如果它与
useHash
一起工作,则需要将服务器配置为支持HTML5 pushState。对于所有类型的服务器,都有足够的答案。非常感谢@GünterZöchbauerEmpty path routes
{path:,component:HomeComponent},
如果没有子级,应该使用
路径匹配:“true”
。我假设您的服务器未配置为支持HTML5 pushState。您可以尝试切换到HashLocationStrategy并检查它是否以这种方式工作。这将证实我的建议(imports:[RouterModule.forRoot(myRoutes,{useHash:true})]`@GünterZöchbauer现在路由工作,我如何删除uri中的#?通过删除
,useHash:true
-),我建议这样做只是为了找到根本原因。如果它与
useHash
一起工作,则需要将服务器配置为支持HTML5 pushState。各种服务器都有足够的答案。非常感谢@GünterZöchbauer