Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var app = angular.module('part3', []);
- app.controller('Part3Controller' ,function ($scope) {
- $scope.Message1 = "apek";
- $scope.IsLogedIn = false;
- $scope.Message = '';
- $scope.Submitted = false;
- $scope.IsFormValid = false;
- $scope.LoginData = {
- UserName: '',
- Password: ''
- };
- $scope.$watch('f1.$valid', function (newVal) {
- $scope.IsFormValid = newVal;
- });
- $scope.Login = function () {
- $scope.Submitted = true;
- if ($scope.IsFormValid) {
- alert("eeeeee")
- alert("dsds")
- serv.GetUser($scope.LoginData).then(function (d) {
- alert("dsdsdfsdfs");
- if (d.data.UserName != null) {
- alert("he;llo1");
- $scope.IsLoggedIn = true;
- $scope.Message = "Successfully Login" + d.data.FullName;
- }
- else {
- alert("Invalid Credential")
- }
- })
- }
- }
- })
- app.factory('serv', function ($http) {
- alert("helloo");
- var fac = {};
- fac.GetUser = function (d) {
- $scope.Submitted = true;
- return $http({
- url: '/Data/UserLogin',
- method: 'POST',
- data: JSON.stringify(d),
- header: { 'content-type': 'application/json' }
- });
- };
- return fac;
- });
- app.controller('Part3Controller' ,function ($scope,serv){//yourcode});
- controller('Part3Controller' ,function ($scope,serv) {
Add Comment
Please, Sign In to add comment