繁体   English   中英

角度路由器链接重定向到 404

[英]angular routerlink redirect to 404

我有角度的路由器链接问题。 我使用路由器链接重定向到我的应用程序中的下一页。

如果我用 ng serve 开始我的应用程序,一切正常。 如果我使用 ng build --prod routerlinks 构建我的应用程序,在某些情况下会返回 404。

确切的问题:我正在使用路由器插座来显示不同的组件。 如果我单击路由器插座中显示的组件中的路由器链接,我会得到 404。如果我使用路由器插座外部的 component.html 中的路由器链接,一切正常。

那是我的路由器插座

<div class="">
  <router-outlet></router-outlet>
</div>

那是我的路由器链接

              <a [routerLink]="['overview']" [queryParams]="{categorie:'Shopping',subcategorie:'topcategorie'}"
                 class="btn btn-primary searchbutton">suchen</a>

那是我的路线:

const routes: Routes = [

  { path: 'overview/:categorie/:subcategorie', component: OverviewComponent },
  { path: 'overview', component: OverviewComponent },
  { path: 'overview/:brand', component: OverviewComponent },
  { path: 'overview/:product', component: OverviewComponent },
  { path: 'coupons', component: CouponComponent },
  { path: 'impressum', component: ImpressumComponent },
  { path: 'datenschutz', component: DatenschutzComponent },
  { path: 'details/:id', component: ProductDetailsComponent },
  { path: 'home', component: LandingpageComponent },
  { path: '', component: LandingpageComponent }
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})
export class AppRoutingModule { }

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM