My World.json file is quite large and contains extensive data on countries worldwide. I've been utilizing a list to display this data in a table format, with the intention of sorting all values accordingly. However, I have encountered an issue - all my integer values are formatted as strings within world.json. While I understand that I need to use parseInt to resolve this problem, I have attempted various methods without success.
Here's a snippet of code from World.js:
"Country": [
{
"Code": "AFG",
"Name": "Afghanistan",
"Continent": "Asia",
"Region": "Southern and Central Asia",
"SurfaceArea": "652090.00",
"IndepYear": "1919",
"Population": "22720000",
"LifeExpectancy": "45.9",
"GNP": "5976.00",
"GNPOld": "NULL",
"LocalName": "Afganistan/Afqanestan",
"GovernmentForm": "Islamic Emirate",
"HeadOfState": "Mohammad Omar",
"Capital": "1",
"Code2": "AF"
},
{
controller.js
countryApp.controller('ctrlMain', function($scope, $http) {
$http.get('world.json').success(function(data){
$scope.world = data;
});
});
countryApp.controller('detailsCtrl', function($scope, $routeParams){
$scope.name = $routeParams.countryName;
});
all.html
<td class="heading"><a href="" ng-click="reverse = predicate == 'LifeExpectancy' && !reverse; predicate = 'LifeExpectancy'">Befolkningsmängd</a></td>
<tr ng-repeat="country in world.Country | filter: { Continent: vDel } | filter:search | orderBy: predicate:reverse">
<td>{{ country.Population }}</td>
</tr>