I must translate data from a REST service. The data is in the database, the client want this.
In frontend I have this:
Controller:
CreateListService.getCharacteristic().then(function(response){
vm.createListData = response.data;
});
View:
<select
name=""
id="territory"
class="form-control"
data-ng-options="item.labelEn for item in vm.createListData.territory track by vm.createListData.territory"
ng-model="territory">
</select>
JSON:
{
"confidentiality":[
{
"id":200,
"labelFr":"Publique",
"labelEn":"Public"
},
{
"id":201,
"labelFr":"Restreinte",
"labelEn":"Restricted"
}
],
"issuer":[
{
"id":600,
"labelFr":"Federal Register - OFAC",
"labelEn":"Federal Register - OFAC"
},
{
"id":601,
"labelFr":"Ofac",
"labelEn":"Internet Ofac"
}
],
"scope":[
{
"id":700,
"labelFr":"Locale",
"labelEn":"Local"
},
{
"id":701,
"labelFr":"Groupe",
"labelEn":"Group"
}
]
}
Is: Angular 1.4.9, Angular translate: 2.11.1
My question is how can I change values in view (based on rest key: labelFr and labelEn) when user change language?
I try like this in view: item.{{labelLang}} for item in vm.createListData.scope track by vm.createListData.scope
and in controller: $rootScope.labelLang = "label" + capitalizeFirstLetter($scope.selectedLang); but the values in not updated.
Thank you for all informations!