UI-路由器重新加载状态,无需刷新整页 [英] UI-Router Reload State without a full page refresh

查看:52
本文介绍了UI-路由器重新加载状态,无需刷新整页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,如果要重新加载状态,则必须使用$ state.reload().这将导致整页刷新,这是非常不友好的.我正在寻找一种方法来重新解析我的依赖关系并重置控制器.这可能吗?

Currently if I want to reload a state, I have to use the $state.reload(). This causes a full page refresh, which is very unfriendly. I am looking for a way to just re-resolve my dependencies and reset the controller. Is this possible?

推荐答案

只需添加@Dag的答案:

Just to add on @Dag 's answer:

请注意,从 0.2.14 开始,您还拥有一个选项只是重新加载当前状态,而不是父状态.

Do note, as of 0.2.14 you also have an option to just reload the current state and not it's parent.

因此$state.go(people.search, {}, {reload: true});将重新加载people状态及其所有子状态.

So $state.go(people.search, {}, {reload: true}); would reload the people state as well as all its childs.

$state.go(people.search, {}, {reload: "people.search"});不会重新加载people状态,但是会重新加载people.search及其子级.

While $state.go(people.search, {}, {reload: "people.search"}); would not reload the people state but would reload people.search and its childs.

这篇关于UI-路由器重新加载状态,无需刷新整页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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