mercredi 21 octobre 2015

Remove checked row Angular

I have a list of field in row. The user can add the row. How can I make a function which removes the checked rows? I was thiking to add to them in a new array, but i don't know how to filter the selected item.

http://ift.tt/1OS4CBW

  <body ng-controller="DuplicateInputCtrl" class="container">
<div data-ng-repeat="food in foods">
  <div class="form-group title-field">
    <label for="">Food</label>
    <select class="form-control input-full" data-ng-model="food.Selection"
        data-ng-options="foodType.code as foodType.type for foodType in foodTypes">
        <option value="">Select</option>
    </select>
    <input type="hidden">
    <button data-ng-click="removeItem($index)" class="btn delete-field-{{$index}}">
      Delete
    </button>
  </div>
  <div class="form-group">

        <input style="background: white; color: black;" type="text" id="myInput"  class="form-control" data-ng-model="food.Text"/>

    </div>
</div>
{{foods | json}}
<button data-ng-click="cloneItem()" class="btn inline">
  Add
</button>    
    <button data-ng-click="" class="btn inline">
  Remove Selected
</button>  

Thank you!




Aucun commentaire:

Enregistrer un commentaire