Angular Browser History back without reload previous page

喜欢而已 提交于 2019-12-25 07:29:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!