I've doing some research on this topic, but I can't seem to move forward, most likely for not being able to use the correct keywords to explain my problem.
I'm developing a website with AngularJS, and some of the user actions on it require authentication, like adding a certain item to its favorites, commenting on a post, follow a user, etc.
Every time a person (non logged-in user) attempts one of this actions, he gets prompted with a modal to perform the log-in action. In order to better handle the app state and consistency, I'm doing a page reload. This means losing the state where the user was before the log-in. Imagine trying to favorite a item which resulted from a filtered search and the results were paginated with infinite-scrolling; handling all this information seems unfeasible after a full-page reload, since the data is kept in the controller's $scope. I'm trying to pick an edge case, so you can better understand the gravity of my situation.
Is there a way to keep a state on Angular, like for example how PHP handles it, by attaching these parameters on the URL and performing them when all necessary conditions are fulfilled?
Solving this, would probably help me out on other scenarios, like when sending a newsletter where I'd send a URL with the action for the user to perform, such as:
http://www.example.com/like?item=123412
Meaning the user would try to like/favorite this particular item. If already logged in, like it, otherwise prompt login and perform it after.
On this question I'm suggesting the parameters approach, but you happen to know any other, I'm open to any suggestions that might point me to the right direction.
Thank you.