I am trying to make a listing of the types of payments available in the pagseguro api.
To do this I use a js function of the pagseguro called PagSeguroDirectPayment.getPaymentMethods ()
The problem is that in the callback of this function, I can not access my angular variables. When I create a normal variable it can access. If I put a button to put the data of the normal variable in the angular one it works, but I wanted it to load in the function callback.
var self = this;
this.lista = [];
PagSeguroDirectPayment.getPaymentMethods({
success: function(response) {
self.lista.push({"nome": "Cartão de Crédito", "img":"../static/img/cartao.png", "objpag": response.paymentMethods.CREDIT_CARD});
self.lista.push({"nome": "Débito Online", "img":"../static/img/debito.png", "objpag": response.paymentMethods.ONLINE_DEBIT});
self.lista.push({"nome": "Boleto", "img":"../static/img/barcode.png", "objpag": response.paymentMethods.BOLETO});
},
error: function(response) {
//tratamento do erro
},
complete: function(response) {
}
});