Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

102
Visualizações
Save all inputs from the user

I have an table with a column for the user input. Obviously, the table can have several rows, every row with an input for the user. Under the table I have a button for saving. My question is: if a user type in several inputs, how can I save all the inputs? Example: my table is something like:

row1 -> input (user writes here: "stack")
row2 -> input (user writes here: "overflow")
saveButton

I want to save "stack" and also "overflow". My code is:

<div class="mat-elevation-z8 layout-container">
  <table mat-table [dataSource]="dataSourceTable">
    <ng-container matColumnDef="userInput">
      <th mat-header-cell *matHeaderCellDef [attr.rowspan]="2">Input</th>
      <td mat-cell *matCellDef="Input">
        <mat-form-field class="full-width">
          <input matInput/>
        </mat-form-field>
      </td>
    </ng-container>
  </table>
</div>
<button mat-raised-button color="warn" (click)="saveInput()">Save</button>
about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

You can define your cell like this:

<ng-container matColumnDef="userInput">
  <th mat-header-cell *matHeaderCellDef [attr.rowspan]="2">Input</th>
  <td mat-cell *matCellDef="let Input">
    <mat-form-field class="full-width">
      <input matInput [(ngModel)]="Input"/>
    </mat-form-field>
  </td>
</ng-container>

and setup an ngModel on your Input data.

about 4 years ago · Juan Pablo Isaza Relatório

0

You can use Formbuilder then add the input fields. You then add a method onSubmit() to process the filled form that's be called within the <form> tag and add a button of type submit.

You can follow the guide here for detailed steps on how to do it.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda