html - Number of checkboxes checked using javascript, angularJS and bootstrap -


i have tag using class="glyphicon glyphicon-shopping-cart" bootstrap. , add on bottom right number of check-boxes checked , display new number each time user checked or unchecked on of box. glyphicon in header , check-boxes displayed in ng-repeat loop. have difficulty angularjs , don't know how it, if have use directive, or controller. if got kind of take it.

my view check-boxes itemsearch-result.js there no controller, directives

<tbody>      <tr ng-repeat="item in chart.items>          ...          <td>{{ ad.price | ypcurrency }}</td>          <td> <input type="checkbox"> </td>      </tr> </tbody> 

my header view, controller: ng-controller="headerctrl"

<ul class="nav-right pull-right list-unstyled">         <li>           <a class="toggle-min" href>               <i class="glyphicon glyphicon-shopping-cart"></i>           </a>         </li>         <li class="dropdown text-normal nav-profile" dropdown>             <a href class="dropdown-toggle" dropdown-toggle>                 <span class="hidden-xs">                     <span>{{user.firstname}} {{user.lastname}}</span>                 </span>                 <i class="fa fa-user"></i>             </a>         </li>         ... </ul> 

there lots of ways accomplish this. first of all, make sure know difference between directive , controller shown here.

look using events need talk controller/module.

that way can create service gets injected both controllers update amount of selected items (as opposed using $rootscope) , set on glyphicon. (not sure without seeing code)