Formarray Ionic

Asked

Viewed 34 times

0

I am receiving the information from my database and showing on screen using *ngFor, this information is products, on that screen, the customer puts the quantity in the product. However I am having difficulty sending this information, are 2 inputs per product, so it is an array, because I can send several products each with a specific quantity, an input sending the product ID and another sending the Quantity.
In html would define the tag name="id[]" and the tag name="qtd[]", but in Ionic it does not work.
Summarizing: How can I send an array in the Ionic input.

Code of *ngFor

 <ion-item style="margin-top: 20px;" *ngFor="let item of items; let i=index">
  <ion-input formControlName="nome[]" type="hiddem" value="{{item.id}}" required></ion-input>
  <ion-label>
    <div color="tertiary" style="font-size: 15pt;">{{item.setorNome}} {{item.produto}}</div><br>
    <div style="font-size: 11pt;">{{item.formato}} - R${{item.valor}} - Estoque: {{item.qtd}}</div>
  </ion-label>
  <ion-select interface="action-sheet" formControlName="qtd[]" placeholder="0">
    <ion-select-option value="">0</ion-select-option>
    <ion-select-option value="1">1</ion-select-option>
    <ion-select-option value="2">2</ion-select-option>
    <ion-select-option value="3">3</ion-select-option>
    <ion-select-option value="4">4</ion-select-option>
    <ion-select-option value="5">5</ion-select-option>
  </ion-select>
</ion-item>
  • I got a solution

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.