I have a little problem with checkboxes :
I have an array of objet. I do a ng-repeat on this array and i associate checkboxes on each element.
<li ng-repeat="title in treeZone track by $index">
<input type="checkbox" ng-model="title.selected" ng-click="functionAdd($index, title.selected)"/>
</li>
My problèm is that i would like to get all the selected checkboxes with a funciton.
Do do it, i wrote that :
scope.funtionAdd = function() {
scope.tree_array = "";
angular.forEach(scope.treeZones, function(title) {
if (title.selected) {
scope.tree_array = scope.tree_array + title.name + " ";
}
});
}
This function works well but it cause that error : "Property 'selected' does not exist on type 'Zone'" due to "title.selected"
Knowing that my Zone object have 3 properties : id, name, parent.
How resolv this issue knowing that my only way to know if a Zone is selected, is with " title.selected " .
Thanks for help :)
Aucun commentaire:
Enregistrer un commentaire