I can't pass the content of one variable inside $http.get()
to outside of this method... it's always undefined
.
I tested with $rootScope
, but it didn't work.
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);
});