【发布时间】:2021-02-04 23:34:01
【问题描述】:
我有这个数组,我从中构建表的标题,但我无法根据语言显示标题。我正在使用 ngx 翻译。
我的 html 模板中有这个:
<thead>
<tr>
<th>#</th>
<th *ngFor="let col of columns" class="cursor-pointer" (click)="sort(col.propertyName)">
{{col.label}}
</th>
</tr>
</thead>
我的 .ts 组件中有这个
columns = [
{ label: 'Nombre', propertyName: 'name' },
{ label: 'Imagen', propertyName: 'image' },
{ label: 'Descripción', propertyName: 'description' },
{ label: 'Categoria', propertyName: 'category' },
{ label: this.translateService.get('form.purchasePrice'), propertyName: 'purchase_price' },
{ label: 'Precio Unitario', propertyName: 'unit_price' },
{ label: 'Acción', propertyName: 'action' }];
尝试使用 translateService 获取、即时、流式传输
但我没有得到想要的结果
【问题讨论】:
标签: angular translate ngx-translate