title: how do I execute a function in angular.js, from an input checkbox?
body: <p>I have a list of things with switches. How can I get each switch to call a function with that object and the switch as parameters?</p>
  
  <p>I have tried to set the "ng-change" directive for my checkboxes, but the function doesn't seem to get called. How do I call the toggleSync function I made?</p>
  
  <p>I am a total newb, so I'm sorry if I need serious help.</p>
  
  <pre><code>&lt;div id="track-list" ng-controller="Controller" ng-init="update()"&gt;
    &lt;div class="data-table"&gt;
    &lt;table class="table table-hover tablesorter"&gt;
      &lt;tr ng-repeat="item in items"&gt;
        &lt;td&gt;&lt;a href='{[{item.path}]}/{[{item.id}]}'&gt;{[{item.title}]}&lt;/a&gt;&lt;/td&gt;
        &lt;td&gt;{[{item.time_created}]}&lt;/td&gt;
        &lt;td&gt;
          &lt;div class=checkbox&gt;
            &lt;input ng-model="value" id="check{[{$index}]}" type="checkbox" ng-checked="!item.deleted" ng-change="toggleSync(item.id, this)" ng-true-value="YES" ng-false-value="NO"/&gt;
            &lt;label for="check{[{$index}]}"&gt;{{value}}&lt;/label&gt;
          &lt;/div&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
  
  
  function Controller($scope) {
    console.log("init");
    $scope.items = [];
  
    $scope.toggleSync = function(objectId, input) {
      console.log("toggle sync");
    }
  }
  </code></pre>