虽然选项reloadOnSearch设置为false力AngularJS重新加载路由 [英] Force AngularJS to reload a route although option reloadOnSearch is set to false

查看:580
本文介绍了虽然选项reloadOnSearch设置为false力AngularJS重新加载路由的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我AngularJS应用的路由配置大部分航线都与选项定义的 reloadOnSearch 设置为因为大多数的时候,搜索参数改变了页面不应该重新加载。

In the route configuration of my AngularJS application most of the routes are defined with the option reloadOnSearch set to false as most of the time a page should not reload when search parameter changed.

但在罕见的情况下,我需要一个不同的行为,我需要虽然只是搜索参数改变以重新加载URL。

But in rare circumstances I need a different behaviour where I need to reload the URL although only the search parameters changed.

有没有办法强制AngularJS重新加载URL虽然 reloadOnSearch 设置为

Is there a way to force AngularJS to reload the URL although reloadOnSearch is set to false?

推荐答案

我还没有尝试过的事,但你可以尝试的。

I have not tried it, but something that you can try is.

$ routeUpdate 事件处理函数调用 $ route.reload()方法,如果您知道条件应引起路由刷新。

In the $routeUpdate event handler call the $route.reload() method if you know the condition that should cause refresh of route.

这篇关于虽然选项reloadOnSearch设置为false力AngularJS重新加载路由的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆