remember the functions
can not be equal to our public variable, in this sample you have $scope.users
as function
and also you have that again equal to response.data
(actually you miss the function
)
you can't read from files, you have to use api URL which return json
to you
$scope.users = $http({
method: 'GET',
url: 'functions.php/getUsers()'
}).then(function(response){
$scope.users = response.data;
},function(reason){
$scope.error = reason.data;
});
}
change to
$scope.getUsers = function(){
//for example api url for your users is "http://localhost:8080/users"
var api = "you api url";
$http({method: 'GET', url: api}).then(function(response){
$scope.users = response.data;
},function(reason){
$scope.error = reason.data;
});
}
}
//request data
$scope.getUsers();
OR use it directly without function
//for example api url for your users is "http://localhost:8080/users"
var api = "you api url";
$http({method: 'GET', url: api}).then(function(response){
$scope.users = response.data;
},function(reason){
$scope.error = reason.data;
});
}