0
Well, I’m developing an app with Ionic 3. When I try to record some data in the array, it appears " n" at the beginning and end of the array. Follow the code :
element = this.pedido.produto;
if (this.vetCarrinhoAux.indexOf(element) === -1) {
this.vetCarrinho.push(element);
localStorage.setItem("vetor", JSON.stringify(this.vetCarrinho));
At Localstorage, he’s like this :
[\n celular \n]
Try using the . Trim()
– Prostetnic Vogon Jeltz
Thank you so much for your help. It worked.
– user125721