i am using simple get method
var self= this;
self.items = [];
var fetchGraphs = function() {
return $http.get('/api/graph').then(
function(response) {
self.items = response.data;
alert(self.items);
}, function(errResponse) {
console.error('Error while fetching notes');
});
};`
to get the following JSON data.
{
"Msg": "Running",
"excMsg": null,
"array1": {
"key1": 32,
"key2": 10,
"key3": 24
},
"array2": {
"key4": 42,
"key5": 20,
"key5": 22
}}
Now I have to draw graph for array1 and array2. for that i have to declare the values from get method inside script itself.but its giving me error for
"can not read key1 property."
Can anyone please tell me how to declare array variables that I get from JSON in the another script file