0

I am trying to populate a checkbox, a label and two text boxes on ng-repeat loop.

When the checkbox is selected, its corresponding row is enabled for text boxes to be editable. I need to get the data entered in the first row and then copy that data to the next rows which ever is selected.

<div class="row" ng-repeat="option in coverages"> 
  <div class="col-md-3">
    <input id="{{option}}" type="checkbox" ng-model="optionChecked" class="border-horizontal" />
    <label for="{{option}}">{{option}}</label>
  </div>
  <div class="col-md-3">
    <input type="text" class="form-control input-sm border-horizontal" ng-disabled="!optionChecked" />
  </div>
  <div class="col-md-3"><input type="text" class="form-control input-sm border-horizontal" ng-disabled="!optionChecked" /> 
  </div>
</div>
Jax
  • 1,839
  • 3
  • 18
  • 30
Shubh
  • 19
  • 6

1 Answers1

0

If I understand correctly you need to know if previous value is checked and you neeed to access previous value, then you can probably refer to this How to obtain previous item in ng-repeat? Is this what you are looking for?

Shyam Babu
  • 1,069
  • 7
  • 14
  • The previous field might not be selected.....i can make use of only the first row text field and populate that textbox column of the grid with that value. – Shubh Aug 31 '17 at 18:28
  • if you just want the first value you can directly access it coverages[0] should give you the first row value – Shyam Babu Aug 31 '17 at 18:46