Angular:如果语言更改则刷新面包屑

问题描述 投票:0回答:0

用户可以在其设置中更改语言。现在我发现当我更改语言时,面包屑不会被翻译。当我移动到另一个页面时,面包屑会首先被翻译。

我现在的问题是,当我更改语言时如何刷新面包屑项目,它们会立即翻译,而不是在我移动到另一个页面时首先翻译。

我直接在 [name].module.ts 文件中设置面包屑项目显示值,例如:

const routes: Routes = [
  {
    path: "",
    component: SettingsOverviewComponent,
    canActivate: [LoginService],
  },
  {
    path: "profile",
    component: UserProfileComponent,
    canActivate: [LoginService],
    data: {breadcrumb: "accountAdministration"}
  },
  {
    path: "allUsers",
    component: UsersComponent,
    canActivate: [LoginService],
    data: {breadcrumb: "allUsers"}
  },
];

有人有想法吗?

angular breadcrumbs
© www.soinside.com 2019 - 2024. All rights reserved.