After the internationalization of the Ionic app (2) after the processing of the JSON array, how to deal with the length of JSON data, one of the current tradeoffs is to translate the length field.
Multi-language file content:
"Myla": { "Length": "2", "values": [ { "name": "Huanhuan", "Value": "1" }, { "name" : "Alex", "Value": "2" } ] },
HTML page Fragment:
<ion-list ng-init="items = getItems (' myla.length ')"> <ion-item ng-repeat= " Item in Items "> 'myla.values. '+item+'. Name' | translate}} Contoller class method
$scope. GetItems = function (len) { var push = []; $translate (len). Then (function (Result) { for (var i =0 ; i< result;i++ ) { Push.push (i); } }); return push; }
This allows us to get the subscript of the array and then access the corresponding member content.
Internationalization of the Ionic app (3) processing of JSON arrays