子状态中的Angular ui路由stateparam [英] Angular ui route stateparam in substate
问题描述
我在子状态中使用stateparam时遇到一些问题.
I have some issues with using a stateparam in a substate.
这是我的主人"状态
.state("shop", {
abstract: true,
url: '/shop/:nameSlug',
templateUrl: '/views/shop/index.html',
controller: 'shopController',
params: {
nameSlug: null,
}
})
这是我的子状态:
.state('shop.payment-success', {
url: '/payment-success?transactionid',
templateUrl: '/views/payment-success.html',
controller: 'checkoutController'
})
我想在控制器中使用参数'transactionid',但是当我记录它时,它是未定义的.
I want to use the param 'transactionid' in my controller, but when I log it, it's undefined.
我尝试使用$ stateParams和$ state.params,但是它们之间没有区别.
I have tried with $stateParams and $state.params, but there is no difference between them.
有没有办法使transactionid在'checkoutController'中可用?
Is there a way to make transactionid available in 'checkoutController'?
供您参考:参数?transactionId来自支付网关,我无法更改.它包含orderId,即我需要支票才能真正付款.
For your information: the param ?transactionId is coming from a payment gateway and I can't change it. It contains the orderId, what I have been needed for a check for a genuine payment.
推荐答案
请尝试以下操作: 查看全文