I currently use the material data table and the ngx-trnslate library
I manage to iterate on an object in a data table, but the problem is that I only have to translate properties.
I’ve seen the code that allows you to iterate on an object like this:
<tr *ngFor="let i of (identy| keyvalue)">
<td>{{ i.key }}</td>
<td>{{ i.value }}</td>
</tr>
Here is my object, it's a fake, values will be provided by the server later
identity = {
prenom: "toto",
nom: "titi"
}
But how can I translate the key here in my json files ?
"PROPERTIES":
{
"prenom": "surname",
"nom": "name"
},
I tried to use the get observable like this:
this.translate.get(
['PROPERTIES.prenom', 'PROPERTIES.nom'])
.subscribe(val => {
this.tradPrenom = val['PROP.prenom'];
this.tradNom = val['PROP.nom'];
});
I’ve been struggling with this for a few hours without finding any solutions. Thank you for your help