hi i'm beginner in angular, i want to know why i'm getting an empty array when i call it out of my service, this is my code :
var app = angular.module("myModule", ['ngResource']);
app.controller("myController", function ($scope,$http,$log,myService) {
$scope.users = []:
myService.query(function(data) {
$scope.users=data;
// all is fine, the length is 10 obj
console.log("users in: "+$scope.users.length);
});
//here i want to use my $scope.users array but the length is 0
console.log("users out: "+$scope.users.length);
});
any idea on how to deal with this issue thanks in advance.