【问题标题】:How to stop page refresh when changing url by history.replacestate in angularjs?在angularjs中通过history.replacestate更改url时如何停止页面刷新?
【发布时间】:2019-09-30 04:33:02
【问题描述】:

我正在通过在我的 angularjs+jade+nodejs 应用程序中单击跨度来更新我的页面 URL。 http://192.xxx.0.xxx:7071/page-1/bloghttp://192.xxx.0.xxx:7071/page-2/blog

我正在使用 history.replaceState 进行更改。 但是随着函数的执行,页面会自动刷新。 我想使用 replaceState 停止重新加载。还有其他解决方案吗?

如果我在浏览器的控制台中编写 history.replacestate(null, null, '/page-2/blog') ,它工作得很好。

【问题讨论】:

    标签: node.js angularjs pug


    【解决方案1】:

    你应该看看 "reloadOnSearch: false" 。

    如果你在你的 angularJS 模块中添加这个,你就不能禁用刷新

    [reloadOnSearch=true] - {boolean=} - 使用 true 重新加载路由,如果您不想刷新,则使用 false 。

    【讨论】:

      猜你喜欢
      • 2011-08-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-08-14
      • 1970-01-01
      • 2015-11-14
      • 1970-01-01
      相关资源
      最近更新 更多