问题
i have a AngularJS app with list of items and the detail of the item.
If I do some changes in detail and I want to return to list , list is already created again via remote request.
What is the best practice to stop reloading page after return from detail?
I tried to solve it via this topic:
angularjs getting previous route path
But without luck.
In list I'm using:
data-ng-controller="UsersCtrl" data-ng-init="initGrid()"
I think that problem is here.
Thanks for any advice and simple example.
回答1:
The recommended approach here is to use services to provide the data so that you can serve up the same data when you return to the controller.
Your service should maintain the state of the previous view so that you can re-populate the scope when the controller is re-instantiated.
来源:https://stackoverflow.com/questions/24653265/angular-browser-history-back-without-reload-previous-page