I am trying to do something like tree-checkboxes. I would like to add boolean to children of checked name : ex. after click checkbox at name
: eva
- all her childrens will be also checked. Like that :
$scope.messages =
{
"family": [
{
"name": "eva",
"checked" : true,
"childrens": [
{
"name": "John",
"checked" : true,
"childrens": [
{
"name": "Jacob",
"checked" : true,
}
My code :
<div ng-repeat="key in messages">
<ul ng-repeat=" (x, y) in key" style="list-style:none;">
<li>
<input type="checkbox" ng-model="y.check" ng-change="changeValue(shapes, y.name)" /> </li>
<li style="margin-left:15px;" ng-repeat="(a,b) in y.childrens">
<input type="checkbox" ng-model="b.check" ng-change="changeValue(shapes, b.name)" />
<ul style="margin-left:15px;" ng-repeat="p in b.childrens">
<li>
<input type="checkbox" ng-model="p.check" ng-change="changeValue(shapes, p.name)" /> </li>
</ul>
</li>
</ul>
</div>
Here is my plnkr : http://plnkr.co/edit/lFYUvcTt1W709vam5Dfv?p=preview
Aucun commentaire:
Enregistrer un commentaire