我在Angular 6中有一个window事件。在令牌事件中,我需要调用Angular方法,该怎么做?
openCheckout(order) {
var handler = (<any>window).StripeCheckout.configure({
key: 'pk_test_',
locale: 'auto',
token: function (token: any) {
console.log(token.id);
console.log(token.email);
// --- makePayment ERRORS AS UNDEFINED
this.makePayment(token.id, token.email);
location.reload();
}
});
handler.open({
name: 'Name',
description: 'Desc',
currency: 'gbp',
amount: order.transactionAmount,
image: 'https://stripe.com/img/documentation/checkout/marketplace.png'
});
}
预先感谢
答案 0 :(得分:0)
感谢康纳,成功了!
var handler = (<any>window).StripeCheckout.configure({
key: 'pk_test_',
locale: 'auto',
token: (token: any) => {
console.log(token.id);
console.log(token.email);
this.makePayment(token.id, token.email);
}
});