我正在使用自动面包屑模块,我需要使用我的 TranslateService 翻译标题,当我在其他组件和显示面包屑的布局组件中声明路由常量时,如何使用它。
我尝试过:
<nz-breadcrumb [nzAutoGenerate]="true" [nzRouteLabel]="'breadcrumbI18nKey'" [nzRouteLabelFn]="translateFn">
</nz-breadcrumb>
//组件中
translateFn = (key:string) => this.translateService.instant(key);
//路线中
{
path: '',
data: {
breadcrumbI18nKey: 'i18n.name'
}
}
但是translateFn函数没有找到密钥。