I'm developing an app with ionic 3 and Firebase. I am facing problems, therefore, it is not decreasing the value of the product (chosen) of the total. Always subtract the last value informed. Here is the code:
deleteProduto(element) {
if(this.vetCarrinho.length > 1){
this.vetCarrinho.splice(this.vetCarrinho.indexOf(element), 1);
this.acum = (this.acum - this.valTot);
this.pedido.total = element;
save function:
irParaCarrinho(element) {
element = this.pedido.carrinho;
this.vetCarrinho.push(element);
console.log(this.vetCarrinho);
this.pedido.carrinho = this.vetCarrinho;
for (let i = 0; i < this.vetCarrinho.length; i++) {
this.acumulador = this.valTot;
}
this.acum += this.acumulador;
this.pedido.total = this.acum;
this.desabilitar = true;