Tuesday 16 May 2017

how to redirect from login in a MEAN stack

Scenario: We have a MEAN stack that has passport integrated. The app keeps its state on the url: /#/place?order=rel&search=red using angularJS's Routes. However, the Login page is in a complete different rendered page, such that the angular scope is lost. If the user is logged of, how can I pass in the request search URL to the new rendered angular page? I tried:

req.session.redirectTo = req.originalUrl;

but the angular routes are not being returned (req.originalUrl is returned as "/"), therefore I can't redirect the session to the wanted page.



via user3699878

No comments:

Post a Comment