I have a JSON object which I load using $http.get like this:
$http.get("getData.php")//getData.php returns a J son file
.success(function(response) {$scope.data = response;});
The JSON looks like this:
{
"1": {
"1": "*/3 * * * *",
"2": "*/6 * * * *",
"3": "*/3 * * * *",
"4": "* * * * *"
},
"2": {
"1": "*/3 * * * *",
"2": "*/2 * * * *",
"3": "*/3 * * * *",
"4": "* * * * *"
}
}
How can I pass this object to a function under the same controller and access its content?
I tried a few variations, most intuitive was this:
$scope.compare = function (data){
return data[1][1];
}
But none of my attempts worked.