2015-10-05 31 views
0

我使用PayPal Express Checkout並按下'Pay Now'按鈕後成功通過交易Paypal將我重定向到我在我的網站上設置的頁面,問題是我需要將我的網址上附加的Paypal附加到token,我該怎麼做?通過Paypal附加到我在AngularJS的成功網址附加的令牌

這裏的樣本網址:http://localhost:3000/#/buy-points/success?token=EC-7JK95123K5096113P&PayerID=RA85EAH95ZDGJ

我想要得到的token=EC-7JK95123K5096113P

值這裏是我曾嘗試。

$stateProvider 
    .state('buy-points.success', { 
     url: '/buy-points/success/:token', 
     templateUrl: 'path/to/template.html', 
     controller: 'successController', 
     TOKEN: function ($stateParams) { 
      return $stateParams.token || ""; 
     } 
    }) 

回答

1

由於貝寶與查詢參數響應你應該使用?parameter格式,而不是常規的參數解析格式。 另外,如果你想獲得一個TOKEN對象/變量注入你的控制器,你應該將它包含在狀態解析對象中。

你應該這樣做:

$stateProvider 
    .state('buy-points.success', { 
     url: '/buy-points/success?token', 
     templateUrl: 'path/to/template.html', 
     controller: 'successController', 
     resolve: { 
      TOKEN: function ($stateParams) { 
      return $stateParams.token || ''; 
      } 
     } 
    }) 
+0

哇你是精靈?謝謝:) – CENT1PEDE

+0

很高興我能幫到你 – masimplo