HTML:
<button class="btn btn-primary" ng-click="initiatePayment();">Proceed to pay</button>Credit Controller.Js:
$scope.intitiatePayment = function(){
$scope.redirect = response.json.response.data.links;
$window.location.href = $scope.redirect[i].href;
}我有支付网关集成,现在当我点击继续支付按钮,我打开由后端给出的链接后,成功付款,它将重定向到后台配置的JSP页面,现在我想它是自动关闭后5秒,并重定向到我的页面。可以通过客户端处理吗?
发布于 2018-08-10 17:47:45
使用$timeout调用close函数。在close函数中打开您想要页面
myApp.controller('myController', function($scope, $timeout){
$scope.intitiatePayment = function(){
$scope.redirect = response.json.response.data.links;
$window.location.href = $scope.redirect[i].href;
$timeout( function(){
$scope.close();
}, 5000 );
}
$scope.close = function(){
// call your page here
}
})注意:在您的控制器中包含$timeout选项
https://stackoverflow.com/questions/51783073
复制相似问题