3
如何从函数的回调中访问变量。我将举出示例以更直接的问题范围变量 - 将值分配给变量时出错
export class FormComponent {
public pedidoSoft:PedidoSoft = new PedidoSoft();
getBrandCard(){
PagSeguroDirectPayment.getBrand({
cardBin: this.pedidoSoft.numCard,
success: function(response) {
this.pedidoSoft.bandCard = response.brand.name;
},
error: function(response) { },
complete: function(response) { }
});
}
我收到以下错误消息。此错误是当this.pedidoSoft.bandCard接收response.brand.name
加上一个使用Ubuntu :) – cgTag