Search Posts

Category: callback

Nodejs callback response not working as expected

I’m trying to authenticate a user based on values entered in a given form. However, after using res.send(), the function at AngularJS controller is not able to correctly redirect user even if the password and username are correct. Am I handling the callbacks correctly? Controller <script> var app = angular.module(‘myApp’, []); app.controller(“loginController”, function($scope,$http) { $scope.sub = function() { var config = { headers : { ‘Content-Type’: ‘application/x-www-form- urlencoded;charset=utf-8;’ } } $http.post(‘/login’, { data:{ username: $scope.username, […]