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