没有整页刷新的 UI-Router 重新加载状态 [英] UI-Router Reload State without a full page refresh

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

问题描述

目前如果我想重新加载一个状态,我必须使用 $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-Router 重新加载状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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