简体   繁体   English

Angular.js-浏览器后退或后退按钮的实现

[英]Angularjs - Browser Back or Back button implementation

I am working on an application which is using route methods to open webpages for different modules, it is basically a single page application with route methods to load the HTMLs in the body content. 我正在使用路由方法打开不同模块的网页的应用程序,它基本上是一个单页应用程序,具有路由方法以将HTML加载到正文内容中。

I have a search results page and then move to a new page via a link and that proceeding page has a back button to take us to search results page. 我有一个搜索结果页面,然后通过链接移至新页面,并且该继续页面具有后退按钮,可带我们进入搜索结果页面。 On doing that, we are going to search results page but the page context is lost it shows a blank search results page, the old data is gone. 这样,我们将要搜索结果页面,但是页面上下文丢失了,它显示了一个空白的搜索结果页面,旧数据消失了。

How can we maintain that old data using angularjs, as the application is using angularjs? 当应用程序使用angularjs时,我们如何使用angularjs维护旧数据?

Thanks in advance!!! 提前致谢!!!

As the back button redirects to the previous url, one way to resolve your problem would be to use the service $location and base your search on a query string in the url. 当后退按钮重定向到先前的URL时,解决问题的一种方法是使用服务$ location并将搜索基于URL中的查询字符串。

See this documentation for more informations : https://docs.angularjs.org/guide/ $location 有关更多信息,请参阅此文档: https : //docs.angularjs.org/guide/ $ location

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM