在Angular应用程序中显示非英语文本
使用AngularV5,我创建了一个应用程序。在其中一个页面中,我必须以用户选择的语言显示产品说明-在Angular应用程序中显示非英语文本,angular,html,Angular,Html,使用AngularV5,我创建了一个应用程序。在其中一个页面中,我必须以用户选择的语言显示产品说明-\u descriptionLang。描述文本是使用http服务从DB呈现的 HTML- <tr *ngFor="let item of productList"> <td>{{item.productNo}}</td> <td *ngIf="_descriptionLang === 'EN'">{{item.description_
\u descriptionLang
。描述文本是使用http服务从DB呈现的
HTML-
<tr *ngFor="let item of productList">
<td>{{item.productNo}}</td>
<td *ngIf="_descriptionLang === 'EN'">{{item.description_en}}</td>
<td *ngIf="_descriptionLang === 'FR'"><span lang="fr">{{item.description_fr}}</span></td>
<td *ngIf="_descriptionLang === 'GE'"><span lang="de">{{item.description_ge}}</span></td>
<td *ngIf="_descriptionLang === 'IT'"><span lang="it">{{item.description_it}}</span></td>
<td *ngIf="_descriptionLang === 'RU'"><span lang="ru">{{item.description_ru}}</span></td>
<td *ngIf="_descriptionLang === 'SP'"><span lang="es">{{item.description_sp}}</span></td>
</tr>
服务响应JSON-
searchCombinations(searchInput) {
this.productService.getProductDetails(searchInput)
.subscribe(response => {
this.productList = response.records;
});
}
上面的代码没有显示非英语描述,我在“描述”列中变为空白
我不要求将描述从英文翻译成所选语言
有人能帮我吗?你的状况检查很好?@AravindS是的。。。我已经测试过了。例如,像这样使用
您是否也可以提供您的组件逻辑,并仔细检查项目。说明\u fr和类似变量未返回undefined@coder我尝试了[innerHTML]
…结果仍然一样。。