To extract information from a JSON file, I have created a function as shown below:
function getarray(){
$http.get('http://localhost/prebuilt/countries.json')
.success(function(data) {
$scope.countries = data;
});
return data;
}
However, the issue I am facing is that the function does not return any values. I require these return values to be utilized in another function within the same control block.
The beginning of my controller looks like this:
angular.module('theme.charts-flot', [])
.controller('FlotChartsController',
['$scope',
'$timeout',
'$http',
'$parse',
function ($scope, $timeout, $http, $parse) {
Moreover, I am using a template. This controller is responsible for updating the chart in real time.