Hi all,

I'm a beginner with Angular JS, and I think I missed something.

Here is my code :

$scope.listAccueil=function(){
        
        $http.get('/findParams')
            .success(function(data){
                $scope.params=data;
            })
      
        console.log($scope.params); // here $scope.params is empty even 
when '/findParams' bring something

        $http.get('/listHabitats')
            .success(function(data){
                $scope.listHabitats =[];
                for (var habitat in data) {
                    if(habitat.prix>$scope.params.budget){
                        habitat.color='list-group-item-danger';
                        habitat.alert='Budget dépassé';
                    }
                    $scope.listHabitats.push(habitat);
                }
            })
    }

So my problem is, I use $scope.params in the second http call and at that 
time it is empty. I don't understand why ! listAccueil is in a controller, 
and the $scope variable is global to all the controller isn't it ?

Thank you

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to