I am trying to create a user logon page where the user's input is compared against a JSON file of usernames and passwords (yes, I know client-side authentication is a terrible idea, but this is purely for developing my skills and isn't a real project.
$http.get('https://XXXXXXXXXX/user_list.json')
.then(function(response) {
$scope.userlist = response.data;
angular.forEach($scope.userlist, function(item) {});
});
$scope.JSONLogin = function() {
angular.forEach($scope.userlist, function(item) {
if ((item.LoginName == $scope.uName) && (item.Password == $scope.pWord)) {
window.alert("Success); //
}
});
}
I've been looking at this page AngularJS User Login to Json file for some guidance, but I can't seem to get something working. What am I missing?