Im a newbie in AngularJs and do not really know how to get length of response outside function.
var onUsers = function(response){
$scope.users = response.data;
console.log($scope.users.length); //here works
}
But when i try outside onUsers function
console.log($scope.users.length);
I get an error.
console.log($scope.users)?$scope.usersbefore it is assigned theresponse.data.$httpis Promise returning so you need to access the data after the Promise has resolved.