Rafael Figueiredo
Rafael Figueiredo

Reputation: 347

Using angular-ui-router, how to prevent controller from reloading?

I don't know if prevent the controller from reloading is exactly what I need.

I have the following scenario:

A view called client.list.html and it's controller ClientListController (list clients).

A view called client.html and it's controller ClientController (create and edit client)

On the client list, there's a button to edit the clients and some pagination. What I want to do is:

When the user clicks to edit the client and go back to the list, the information (like selected client, current page and results) should be there still. But the controller gets reloaded and everything is lost.

Upvotes: 0

Views: 95

Answers (1)

Naeem Shaikh
Naeem Shaikh

Reputation: 15715

As of my understanding you want to let the data binded to the view still there, correct me if this is wrong.

I had a similar problem where I had to keep the certain data on the view once loaded even if the view is reloaded. In this case you can bind the data to the view through $rootscope. There is only one $rootscope for the application and will not reload even if the view is reloaded.

Upvotes: 1

Related Questions