我有一个带开关的东西列表.如何让每个开关调用具有该对象的函数和交换机作为参数?
我试图为我的复选框设置“ng-change”指令,但似乎没有调用该函数.如何调用我制作的toggleSync函数?
我是新手,所以如果我需要认真的帮助,我很抱歉.
<div id="track-list" ng-controller="Controller" ng-init="update()"> <div class="data-table"> <table class="table table-hover tablesorter"> <tr ng-repeat="item in items"> <td><a href='{[{item.path}]}/{[{item.id}]}'>{[{item.title}]}</a></td> <td>{[{item.time_created}]}</td> <td> <div class=checkBox> <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"/> <label for="check{[{$index}]}">{{value}}</label> </div> </td> </tr> </table> function Controller($scope) { console.log("init"); $scope.items = []; $scope.toggleSync = function(objectId,input) { console.log("toggle sync"); } }