0

I am trying to update my data using angular4. but little bit stuck how to get all the selected values if i click on update button.

`

<table>
<tr *ngFor="let parts of info" class="text-center">
          <td>{{parts.modelD}}</td>
          <td>{{parts.start}}</td>
          <td>{{parts.end}}</td>
          <td><input type="text" class="form-control" name="editable_good_parts" id="editable_good_parts" value="{{parts.good_parts}}" style="max-width:100; text-align:center;"/></td>
          <td><input type="checkbox" name="row_id" value="{{parts.id}}" [checked]="isSelected"/></td>
        </tr>
        </table>
        <button type="submit" class="btn btn-info">Update Data</button>

`

1 Answer 1

1
<table>
    <tr *ngFor="let parts of info" class="text-center">
          <td>{{parts.modelD}}</td>
          <td>{{parts.start}}</td>
          <td>{{parts.end}}</td>
          <td><input type="text" class="form-control" name="editable_good_parts" id="editable_good_parts" value="{{parts.good_parts}}" style="max-width:100; text-align:center;"/></td>
          <td><input type="checkbox" name="row_id" **[value]="parts.id"** [checked]="isSelected"/></td>
    </tr>
</table>
<button type="submit" class="btn btn-info">Update Data</button>

Just checkout with binded value attribute(Eg. [value]="myData" )

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.