Javascript 角度UI路由器和服务器端重定向

Javascript 角度UI路由器和服务器端重定向,javascript,angularjs,.htaccess,redirect,meteor,Javascript,Angularjs,.htaccess,Redirect,Meteor,我正在开发一个小的Meteor应用程序,我遇到了一个小挫折 我使用的是Iron:Router和Angular UI Router,这导致了一些困难。我不得不移除Iron:Router来解决这些问题,这样我就失去了重定向到服务器端URL的好处。我如何使用Iron:Router重定向和处理: Router.route('/payment/:invoice_no/:amount/:userId', { where: 'server', action: function() { var

我正在开发一个小的Meteor应用程序,我遇到了一个小挫折

我使用的是Iron:Router和Angular UI Router,这导致了一些困难。我不得不移除Iron:Router来解决这些问题,这样我就失去了重定向到服务器端URL的好处。我如何使用Iron:Router重定向和处理:

 Router.route('/payment/:invoice_no/:amount/:userId', {
  where: 'server',
  action: function() {
    var amount = parseInt(this.params.amount);
    var url = generate_URL_for_payment_authorization(this.params.invoice_no,this.params.amount,this.params.userId);

    if (url == null) {
        this.response.end("error");
    }

    this.response.writeHead(301, { 'Location': url});
    this.response.end();
  }
});
如何使用Angular UI路由器重写先前的代码:

.state('premiumPayment', {
  url: '/payment/:invoice_no/:amount/:userId',
  controller: function($scope, $stateParams, $http) {

        var invoice_no = $stateParams.invoice_no;
        var amount = $stateParams.amount;
        var userId = $stateParams.userId;

        Meteor.call('testingFunction', invoice_no, amount, userId, (error) => {
          if (error) {
            alert(error);
          }
          else {
            console.log('Going to PayPal screen!');
          }
        });
    }
})
以及测试功能。我想知道我如何重定向一旦我得到了网址

testingFunction: function (invoice_no, amount, userId) {
  console.log(invoice_no);   
  console.log(amount);  
  console.log(userId);

  var url = "";

  if (Meteor.isServer) {
    url = generate_URL_for_payment_authorization(invoice_no,amount,userId);
    console.log("Going to this URL now: " + url);
    //HOW DO I REDIRECT TO THE URL HERE???

  }
}

所以基本上我要问的是,我如何导航到我在testingFunction中得到的URL?我不能使用Iron:Router,因为我会将一些不需要的行为返回到我的应用程序中。

我在此处找到了有关Meteor的不同服务器端路由器的一些信息:。您也可以将URL返回到客户端,然后使用Angular UI router重定向。我不想安装任何新路由器,所以我基本上将URL返回到客户端,然后重定向到该URL。我只是想寻找一个更优雅的解决方案,但这很好。感谢您的时间和指导,大安。