Home AngularJS Login using HTTP Get with a JSON file
Reply: 0

AngularJS Login using HTTP Get with a JSON file

user839
1#
user839 Published in May 27, 2018, 3:38 am

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?

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.30232 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO