$http Post & Passport.js Redirect January 04, 2024 Post a Comment I have a multi-step Angular.js form for signup that saves all the users input into: $scope.user = {}; Then I use ng-submit like so: Solution 1: Not shure, but it might help.In Angular: $scope.signup = function(){ return$http.post('/signup',$scope.user) .then(function(data) { location.replace(data.redirectUrl); // use appropriate function to update route }); }; CopyIn nodejs:Baca JugaAngularjs $scope Not Watching Changes From ViewHow Return Promise From Multiple PromisesGetting Cors (cross-origin...) Error When Using Python Flask-restful With Consuming Angularjs (using $http) app.post('/signup', passport.authenticate('local-signup', { failWithError: true }), function(req, res, next) { // successreturn res.json({ redirectUrl: '/profile' }); }, function(err, req, res, next) { // errorreturn res.json({ redirectUrl: '/' }); } ); Copy Share You may like these postsAngular Testing: Testing Angular Services With Private MethodsCalling AngularJS Function From A Remote Page Loaded By Bootstrap ModalIn Which Cases Angular Directive Scope Equals Controller Scope?Using Redirections Into Promises Chain Post a Comment for "$http Post & Passport.js Redirect"
Post a Comment for "$http Post & Passport.js Redirect"