Try this, var homeApp = angular.module('HomeApp', []); homeApp.controller('HomeController', function ($scope, $http, $window) { $scope.loginname = "Login To Demo App"; $scope.login = function () { var name = $scope.username; var pwd = $scope.password; var req = { method: 'POST', url: '../Account/LoginAccount', headers: { 'Content-Type': undefined }, params: { username: name, password: pwd } } $http(req).then(function (responce) { var url = ''; if (responce.data == "True") { url = '../Account/WelcomePage'; $window.location.href = url; } else { url = '../Account/Login'; $window.location.href = url; } }, function (responce) { }); } });
source share