角度和 ngx 翻译标签问题



我有这个student.component.ts来构造表输出

var html = ......
html +='<li><a class="fanta" data-element-id="' + student.Id + '">Set as Draft</a></li>';
return html;

Ngx-translate是这样的语法{{'Set as Draft' | translate }} 想知道如何添加? .

我在angle changeprofile.component中也有这个.html

<sa-big-breadcrumbs [items]="['Profile', 'Change Password']" icon="star" class="styling"></sa-big-breadcrumbs>

想知道如何添加 {{ '配置文件' | 翻译 }} 和 {{ '更改密码' | 翻译 }} ?

如果你通过代码(var html ...(制作HTML标签,一种方法是在代码中使用翻译管道,如下所示:

import { TranslatePipe} from '@ngx-translate/core';

class YourService {

constructor( private translatPipe: TranslatePipe) {}

YourFunction(value) {
this.translatPipe.transform(value, 'pipeFilter'); // i.e.
}
}

不强制要求始终使用双向数据绑定。

在问题中解释的两种情况下,我们都可以通过使用减速的属性方式来解决它

例:

在您的情况下,它将是这样的

最新更新