I want to get the data of an http response permanently into a scope array to access it globally in my controller :
function myCtrl($scope, $http){
$scope.data = [];
$http.get('myurl').success(function(data, status) {
$scope.data = data;
});
console.log($scope.data)// the output is an empty array, it didn't change
...
}
what am I doing wrong here ? how can I extract the data of the response to a scope array (for example : $scope.data) ?