[AngularJS]:重新加载页面而不返回第一个状态

时间:2016-05-16 07:57:24

标签: angularjs routing angular-ui-router angular-services

我试图关注this approach

虽然它确实重新加载,但它不允许我留在我当前的页面上。它一直回到我的应用程序的第一个状态。

我目前正在使用ui-router。有没有另一种重新加载页面的方法而不回到第一个状态?当我这样做时,我正在经历一个奇怪的闪烁:

$scope.submit = function() {
  $state.go($state.current, {}, {
    reload: true
  });
  doDeposit();
}

然后传递参数(在doDeposit()内):

var oResponse = data;
$state.transitionTo('deposit.status', {
  opts: {
    'response': oResponse,
    'amount': data.amount
  }
});

当前行为:页面重新加载;返回主页一秒钟,然后切换回目标页面。我只需要在其页面内刷新数据。我有一个“再次提交”按钮,重做第一个“提交”的初始行为。它重新处理可用的数据,而不会回到其初始状态。

2 个答案:

答案 0 :(得分:0)

希望这可以帮助您解决问题。祝你好运!

Set URL to SEO Friendly Title with Dashes instead of ID

答案 1 :(得分:0)

我很抱歉,因为第一个回答我复制了错误的链接。希望这可以帮到你:

https://ngmilk.rocks/2015/03/09/angularjs-html5-mode-or-pretty-urls-on-apache-using-htaccess/