One issue I'm facing is the inability to pass the content of a variable inside $http.get()
to the outside scope, as it always returns undefined
.
I attempted using $rootScope
, but that approach was not successful.
controller('myControl', function ($scope, $http) {
var content;
$http.get('../Json/data.json').success(function (data, content) {
content = data;
}).error(function (data, status, headers, config) {
$scope.dataJson = "ERROR";
});
console.log(content);
});