nzRouteLabelFn 不适用于 ngx-translate

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

我正在使用自动面包屑模块,我需要使用我的 TranslateService 翻译标题,当我在其他组件和显示面包屑的布局组件中声明路由常量时,如何使用它。

我尝试过:

<nz-breadcrumb [nzAutoGenerate]="true" [nzRouteLabel]="'breadcrumbI18nKey'" [nzRouteLabelFn]="translateFn">
</nz-breadcrumb>

//组件中

translateFn = (key:string) => this.translateService.instant(key);

//路线中

{
  path: '',        
  data: {
    breadcrumbI18nKey: 'i18n.name'
  }
}

但是translateFn函数没有找到密钥。

angular breadcrumbs ngx-translate
1个回答
0
投票

添加“”前缀键起作用! enter image description here

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