Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

266
Views
How to bind a dynamic html element set to an Angular array?

I have a dynamic set of html elements as below. What I need to do is I need to match each of these element's values to a array. which means each group of attributes inside the for loop needed to push to the array as elements.As you can see RoomTyperesposneDtoList is the array .The input fields values are the properties of the element(object). My component's html code is as below.

<div class="row" *ngFor="let viewRoomType of viewRoomTypes; index as i ;">
    <div class="form-group col-md-2">
      <label for="roomType">Room Type</label>
      <input [(ngModel)]="contractAddRequest.roomTypeResponseDtoList[i].type" name="roomType" type="text"
             class="form-control txt-field-add-update-contract" id="roomType" placeholder="Room Type">
    </div>
    <div class="form-group col-md-2">
      <label for="price">Price per person</label>
      <input [(ngModel)]="contractAddRequest.roomTypeResponseDtoList[i].price" name="price" type="text"
             class="form-control txt-field-add-update-contract" id="price" placeholder="Price per person">
    </div>
    <div class="form-group col-md-2">
      <label for="maxAdults">Maximum no of Adults</label>
      <input [(ngModel)]="contractAddRequest.roomTypeResponseDtoList[i].maxAdults" name="maxAdults" type="text"
             class="form-control txt-field-add-update-contract" id="maxAdults" placeholder="Max adults">
    </div>
    <div class="form-group col-md-2">
      <label for="noOfRooms">No of rooms</label>
      <input [(ngModel)]="contractAddRequest.roomTypeResponseDtoList[i].availableCount" name="noOfRooms" type="text"
             class="form-control txt-field-add-update-contract" id="noOfRooms" placeholder="Available rooms">
    </div>

    <div *ngIf="viewRoomType>0" class="form-group col-md-2 mt-4">
      <button type="button" class="btn btn-danger ">
        <fa-icon [icon]="faTrash"></fa-icon>
      </button>
    </div>

  </div>

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!