【发布时间】:2017-05-09 02:17:39
【问题描述】:
在我的应用中,用户被要求选择一种语言,根据该语言,应用中的所有内容都会更改为该特定语言。我使用一个json数组来获取用户信息,所以我把它存储为,
{"uniqueId":1238902,
{
"english":{
"username":"Sherif",
"phone" :(234)567-0988
},
"arabic":{
"name":"شريف",
"phone": (234)567-0988}}
但我只能在我的 html 中显示一种语言,
{{"User Name" |translate}}:
<input type="text" ng-model="editingInfo[0].arabic.name">
<br>
{{"Phone"translate}}:
<input type="number" ng-model="editingInfo[0].arabic.phone">
<br>
<button ng-click="save()">
控制器:
//selecting specific user to edit
$scope.editing=function(key){
$scope.editingInfo=[];
for (var i=0; i<$scope.userInfo.length;i++)
{
if($scope.userInfo[i].uniqueId == key.uniqueId){
$scope.editingInfo.push($scope.userInfo[i]);
};
};
那么,我将如何在同一个 html 页面中使用这两种语言。我在 html 中调用数据时犯了什么错误。
【问题讨论】: