title: Angular mat-input bind [value] to [(ngModel)]
body: <p>I have this table:</p>
  
  <pre><code>&lt;table class="mat-elevation-z8"&gt;
            &lt;tr *ngFor="let prescription of prescriptions" class="mat-row"&gt;
              &lt;td&gt;
                &lt;mat-form-field class=""&gt;
                  &lt;input  [value]="prescription.description" matInput placeholder="Description"&gt;
                &lt;/mat-form-field&gt;
              &lt;/td&gt;
              &lt;td&gt;
                &lt;mat-form-field class=""&gt;
                    &lt;mat-select&gt;
              &lt;mat-option *ngFor="let object of selectedObjects" [value]="object.id" [(ngModel)]="prescription.idObject"&gt;
                {{object.description}}
              &lt;/mat-option&gt;
            &lt;/mat-select&gt;
          &lt;/mat-form-field&gt;   
              &lt;/td&gt;
              &lt;td&gt;
                &lt;button mat-button class="delete" (click)="check(prescription)"&gt;delete&lt;/button&gt;
              &lt;/td&gt;
            &lt;/tr&gt;
          &lt;/table&gt;
  </code></pre>
  
  <p>where my array prescriptions has this structure:</p>
  
  <pre><code> prescriptions = [
      {
        id: 1,
        description: "Prescrizione 1",
        date1: new Date(),
        date2: new Date(),
        idObject: 0
      },
      {
        id: 2,
        description: "Prescrizione 2",
        date1: new Date(),
        date2: new Date(),
        idObject: 0
      }
    ]
  </code></pre>
  
  <p>Each row of the table represents an object of this array. In each row there's a <code>mat-select</code> element that takes its options from this <code>selectedObjects</code> array:</p>
  
  <pre><code>"selectedObjects": [
          {
              "id":1, "description": "Desc1"
            },
            {
              "id":2, "description": "Desc2"
            },
            {
              "id":3, "descrizione": "Desc3"
            }
  </code></pre>
  
  <p>What I want to achieve is to bind the value of the selected option, that is <code>object.id</code> to the property <code>idObject</code> of the row element. So what I did was using <code>[value]="object.id" [(ngModel)]="prescription.idObject"</code> but it doesn't work, since the property remains 0 for all rows. I've checked this by printing the property in the method <code>check</code> (that is for each row).<br>
  Is there a way to implement this kind of binding?</p>