Answer the question
In order to leave comments, you need to log in
How to restart a factory in AngularJS?
There is an application on Angular, I met such a problem when we log in for a user on the login page, we are transferred to the main page, where there is some data for the current user. The data is pulled using a factory get request, as follows - $resource('api/users/'+token+'/resources'), if you return to the login page and log in as a different user, then the data from the previous user remains on the main page, until the page is refreshed. As I understand it, this is due to the fact that the factory creates an object when the application starts, and then returns it every time. How can this be fixed so that when you log in as another user, you can get a new object?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question