【问题标题】:Empty path redirect me to an other component空路径将我重定向到另一个组件
【发布时间】:2020-01-23 19:47:47
【问题描述】:

我从事一个有角度的项目。我设置了我的空路径,但它直接在 /swap 组件上重定向,我不明白为什么。 我这样设置路径: 谢谢您的帮助。 如果您想了解更多信息,请联系我 :)

const appRoutes: Routes = [
  { path: '', component: AppComponent },
  { path: 'swap', component: SwapComponent}
];       

【问题讨论】:

  • 奇怪:p...它不应该这样

标签: angular url path is-empty


【解决方案1】:

请试试这个……

const appRoutes: Routes = 
[ 
{path: 'app', component: AppComponent }, 
{path: '', redirectTo: '/app', pathMatch: 'full' },
{ path: 'swap', component: SwapComponent},
]; 

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-02
    • 1970-01-01
    • 2020-06-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多