Jorge Guerra Pires
Jorge Guerra Pires

Reputation: 632

Why is two-way binding not working on mat-table?

I am creating a table using Angular Material.

I want that each row makes available an input field, once the user entered the input, it could be saved with the showed table.

Consider the piece of code below:

  <ng-container matColumnDef="comments">
    <th mat-header-cell *matHeaderCellDef>Comments</th>
    <td mat-cell *matCellDef="let element">
      <input
        matInput
        placeholder="Ex. Homo sapiens collagen type IV alpha 6 chain (COL4A6)"
        name="element.description"
        [(ngModule)]="element.comments"
      />
    </td>
  </ng-container>

Due to some unknown reasons to me, it is not working the two-way binding. I have tested, and the problem is indeed the two-way binding.

Any comment?

Thanks in advance,

Upvotes: 1

Views: 1644

Answers (1)

StPaulis
StPaulis

Reputation: 2916

From Material Input Examples the input should be written like this :

<input matInput placeholder="Ex. Pizza" value="Sushi">

Also, if you replace [(ngModule)] with [(ngModel)] it will probably gonna work anyway.

Upvotes: 2

Related Questions