AngularJS UI路由器:重装武力 [英] AngularJS ui-router: force reload

查看:88
本文介绍了AngularJS UI路由器:重装武力的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个AngularJS应用起始于index.html,然后使用UI的路由器。基于触发器我要重新加载整个页面。我想:

I have an AngularJS app starting at index.html and using ui-router. Based on a trigger I want to reload the complete page. I tried:

$state.go($state.current, $stateParams, {
    reload: true,
    inherit: false,
    notify: true
});

但是,这并不工作。它不重装我最初的index.html。

But that does not work. It doesn't reload my initial index.html.

我可以这样做:

window.location.href = "index.html";

但后来我为我的初始页面上的,而不是当前的状态。

But then I'm on my initial page, not the current state.

如若一组 window.location.href index.html的与查询字符串参数指定的当前位置?如果我这样做,我怎么能浏览到这个位置?

Should a set window.location.href to index.html with query string parameters specifying current location? If I do that, how can I navigate to this location?

推荐答案

目前的诀窍是:

$ state.go($ state.current.name,$ state.params,{重装:真});

$state.go($state.current.name, $state.params, { reload: true });

这篇关于AngularJS UI路由器:重装武力的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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