I have a list box containing a list of objects.I have a list of checkboxes corresponding to the elements of the list.On the click of a checkbox,the corresponding value in the list should get selected or deselected, without manual selection of the list.This should happen for all the checkboxes.I am implementing this functionality through angularjs.

this is the code I have written so far.I am able to implement the selection but at a time only one selection is being made. I want multiple selections on the list.

```
<!DOCTYPE html>
<html lang="en">  
 <head>  
   <title>AngularJS Listbox with Checkbox3</title>  
   <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
   <link type="text/css" rel="stylesheet" href="styles.css"></link>  
   <script>  
        var app = angular.module('myapp', []);  
        app.controller('controller', function($scope) { 

            $scope.months = [{name: 'January', selected: false},
                            {name: 'February', selected: false},
                            {name: 'March', selected: false},
                            {name: 'April', selected: false},
                            {name: 'May', selected: false},
                            {name: 'June', selected: false},
                            {name: 'July', selected: false}, 
                            {name: 'August', selected: false},
                            {name: 'September', selected: false},
                            {name:'October', selected: false},
                            {name: 'November', selected: false},
                            {name: 'December', selected: false}]; 

            $scope.selection=[];

              // toggle selection for a given month by name
              $scope.toggleSelection = function toggleSelection(name) {
                 var idx = $scope.selection.indexOf(name);
                 var count = 0;

                 // is currently selected
                 if (idx > -1) {
                   $scope.selection.splice(idx, 1);
                  for(var i=0; i<$scope.months.length; i++)
                  {
                     var obj = $scope.months[i];
                     if(obj.name == name)
                     {
                        count++;
                        $scope.isSelected = function isSelected(monthName, selected)
                        {
                            if(monthName == name)
                            {
                                selected = false;
                                console.log(count+'. '+name+' '+selected+'\n');
                                return selected;
                            }
                        }
                     }
                   }
                 }

                 // is newly selected
                 else {
                    $scope.selection.push(name);
                   for(var i=0; i<$scope.months.length; i++)
                  {
                     var obj = $scope.months[i];
                     if(obj.name == name)
                     {
                        count++;
                        $scope.isSelected = function isSelected(monthName, selected)
                        {
                            if(monthName == name)
                            {
                                selected = true;
                                console.log(count+'. '+name+' '+selected+'\n');
                                return selected;
                            }
                        }
                     }
                   }
                 }
             };         
        });

   </script>  

 </head>  
 <body ng-app="myapp">  
   <div class="box"  ng-controller="controller">
    <div align="center"> 
     <h1>AngularJS Listbox with Checkbox3</h1>  
     <select style="width: 100%;" size="7" ng-model="items" multiple > 
         <!-- ng-options="month.name as month.name for month in months">  -->
         <option ng-repeat="month in months" value="{{month.name}}" ng-selected="isSelected(month.name, month.selected)">
           {{month.name}}
       </option>
     </select>
     </div>    
     <br>
    <div class="panel">
        <div ng-repeat="month in months">
            <div class="action-checkbox">
                <input id="{{month.name}}" type="checkbox" value="{{month.name}}" ng-checked="selection.indexOf(month.name) > -1"
                        ng-click="toggleSelection(month.name)" ng-model="check"/>
                <label for="{{month.name}}"></label>{{month.name}}<span>   {{check}}</span>
            </div>
        </div>
        <br>
        <!-- SELECTED ITEMS -->
        <span style="color:black;" class="selected-item">Selected Items:</span>
        <div ng-repeat="name in selection" class="selected-item">{{name}}</div>
    </div> 
    <h3>You have selected: {{items}}</h3>
   </div> 
 </body>  
</html>

```

Thanks in advance.