1

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?

1
  • Share a plunkr of whatever you have done and we can check what error you are facing Commented May 17, 2018 at 4:52

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.