when I get the result from my http request , I want to modify a scope . To test, I tried to display the scope before making the http request and after its success :
$scope.CopyFiles=function(destination){
  for(var i=0; i<$scope.list.length; i++){
    console.log("test 1 "+$scope.list[i]);
    var response=$http({method: 'GET', url:      
             '/checkIsSubdir/'+$scope.list[i]+'/'+destination});
    response.success(function(result) {
      console.log("check"+result.data);
      console.log("test 2 "+$scope.list[i]);
    });
    response.error(function(data, status, headers, config) {
      console.log("checksubdir oops");
    });
  };
my http request has succeded since it displayed my result.data.
my problem is that the first  console.log("test 1 "+$scope.list[i]); displays the scope but 
console.log("test 2 "+$scope.list[i]); displays undefined 
how to do to fix this ?
 
    