On page load, I get data from a database and place it in $scope.x. In my network tab, I get the list from my database but it is not loaded to the variable which I will soon be needing in a dropdown list by using ng-repeat. After the page load, however, when I click a button that retrieves data and place it in the $scope.x, I get the values already. If I do it like, I don't get the values on page load and just click the button that retrieves the data to the variable, I do not get anything as well. What am I doing wrong. Below is my code:
$scope.addProject = function () {
debugger;
console.log($scope.clientList);
console.log($scope.userList);
};
$scope.getClients = function () {
debugger;
$http.get('/Clients/GetClients')
.then(function (response) {
$scope.clientList = response.data;
});
};
$scope.getAllUsers = function () {
debugger;
$http.get('/User/GetAllUsers')
.then(function (response) {
$scope.userList = response.data;
})
};
$scope.getClients();
$scope.getAllUsers();
$scope.addProject();