I'm new with Javascript and bumped into a funny problem. I have a Json which is alike the following:
{
"TEAM-8f382740": {[
{info1},
{info2},
{info3}
]}
}
I'm trying to get the content behind that "TEAM-8f382740" in my code:
$http.get('https://eune.api.pvp.net/api/lol/eune/v2.4/team/TEAM-8f580740')
.success(function(data) {
$scope.champs = data.??; //what to put here to get just {info1},{info2}...
});
Problem is the 'TEAM-8f382740' is a variable and the same time in a tricky form. I tried the following:
$scope.teamName = 'TEAM-8f580740'; //or var teamName='TEAM-8f580740';
$http.get('https://eune.api.pvp.net/api/lol/eune/v2.4/team/TEAM-8f580740')
.success(function(data) {
$scope.champs = data.$scope.teamName; //data.teamName doesn't work either
});
So how to get that [{info1},{info2},{info3}] content from the Json? I tried with other kind of Jsons and seems if instead of "TEAM-8f580740" there is for example the word "champions" that is not changing, then I can just get the content behind it by $scope.champions = data.champions;
data["TEAM-8f382740"]should work