Guest User

Untitled

a guest
Dec 2nd, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. var app = angular.module('part3', []);
  2. app.controller('Part3Controller' ,function ($scope) {
  3. $scope.Message1 = "apek";
  4. $scope.IsLogedIn = false;
  5. $scope.Message = '';
  6. $scope.Submitted = false;
  7. $scope.IsFormValid = false;
  8. $scope.LoginData = {
  9.  
  10. UserName: '',
  11. Password: ''
  12. };
  13. $scope.$watch('f1.$valid', function (newVal) {
  14. $scope.IsFormValid = newVal;
  15. });
  16.  
  17. $scope.Login = function () {
  18.  
  19. $scope.Submitted = true;
  20.  
  21. if ($scope.IsFormValid) {
  22. alert("eeeeee")
  23. alert("dsds")
  24. serv.GetUser($scope.LoginData).then(function (d) {
  25. alert("dsdsdfsdfs");
  26. if (d.data.UserName != null) {
  27. alert("he;llo1");
  28. $scope.IsLoggedIn = true;
  29. $scope.Message = "Successfully Login" + d.data.FullName;
  30. }
  31. else {
  32.  
  33. alert("Invalid Credential")
  34. }
  35. })
  36. }
  37. }
  38.  
  39.  
  40.  
  41. })
  42.  
  43. app.factory('serv', function ($http) {
  44. alert("helloo");
  45. var fac = {};
  46. fac.GetUser = function (d) {
  47. $scope.Submitted = true;
  48. return $http({
  49.  
  50. url: '/Data/UserLogin',
  51. method: 'POST',
  52. data: JSON.stringify(d),
  53. header: { 'content-type': 'application/json' }
  54. });
  55. };
  56. return fac;
  57. });
  58.  
  59. app.controller('Part3Controller' ,function ($scope,serv){//yourcode});
  60.  
  61. controller('Part3Controller' ,function ($scope,serv) {
Add Comment
Please, Sign In to add comment