简体   繁体   English

返回Angular Browser历史而无需重新加载上一页

[英]Angular Browser History back without reload previous page

i have a AngularJS app with list of items and the detail of the item. 我有一个带有项目列表和项目详细信息的AngularJS应用。

If I do some changes in detail and I want to return to list , list is already created again via remote request. 如果我做了一些详细的更改,并且想返回到list,则已经通过远程请求再次创建了list。

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 angularjs获取以前的路径

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. 感谢您的建议和简单示例。

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. 您的服务应保持先前视图的状态,以便在重新实例化控制器时可以重新填充作用域。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 返回上一页,无需重新加载 - Back to previous page without reload 重新加载浏览器历史记录上的页面后退按钮 - Reload page on browser history back button 添加到浏览器历史记录而不重新加载页面 - Add to browser history without page reload 如何制作history.back()而不在浏览器上收到警告以重新加载页面? - How to make history.back() without getting a warning on the browser to reload the page? 可以通过 Javascript 返回上一页而不重新加载页面吗? - Can back to previous page without reload page by Javascript? 浏览器返回上一页功能,如果返回则如何重新加载文件? - Browser go back to previous page function, how to reload a document if go back? 历史记录后返回Chrome重新加载页面 - Chrome reload page after history.back AngularJS添加到浏览器历史记录,无需重新加载页面,也没有HTML5 pushstate - AngularJS add to browser history without page reload and without HTML5 pushstate 在 Vue 中,如何使用 window.history.go(-1) 使浏览器到 go 返回上一页 - In Vue, how to make browser to go back to previous page using window.history.go(-1) 当我单击浏览器中的后退按钮时,我需要将上一页重新加载到“另一个 URL” - I need to reload the previous page to 'another URL' when I click on back button in browser
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM