mardi 23 février 2016

ngRepeat and checkbox

I have a div with ng-repeat:

<div ng-repeat="fruit in fruits">
  <input type="checkbox" ng-model="this.value" ng-checked="false">{{fruit.code}} - {{fruit.short_name}}
</div>

the furits is array of objects, when foreach object contains this field: code, short_name.

I would like that when the user will click on "submit" button, the function of ng-click on the button, will check which checkboxes are checed, and will insert thier code's fruit to a new array (and will send this new array to the server side... to complete the process).

how can I do it?

p.s. sorry about my broken english...

thank-you.




Aucun commentaire:

Enregistrer un commentaire