Jquery 如何在angularjs中更新html表的数据?

Jquery 如何在angularjs中更新html表的数据?,jquery,angularjs,flot,Jquery,Angularjs,Flot,我有这张桌子 <table class="table table-striped table-bordered table-responsive" ng-show="viewBusinessUnits"> <thead> <tr> <th>Business Unit</th> <th><input type="checkbox" ng-mod

我有这张桌子

     <table class="table table-striped table-bordered table-responsive" ng-show="viewBusinessUnits">
      <thead>
        <tr>
          <th>Business Unit</th>
          <th><input type="checkbox" ng-model="businessUnitSales">Sales</input></th>
          <th><input type="checkbox" ng-model="businessUnitPercentageLY">Percentage Last Year</input></th>
          <th><input type="checkbox" ng-model="businessUnitWTD">WTD Percentage Last Year</input></th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="row in tableData">
          <td><a href="#" ng-click="toggleTable(row.name)">{{row.name}}</a></td><!---->
          <td>{{row.Actual}}</td>
          <td>{{row.Budget}}</td>
          <td>{{row.BudgetVar}}</td>
        </tr>
      </tbody>
    <table>
现在,
plotclick
侦听器末尾的警报告诉我,
$scope.tableData
肯定已更新,但html表中显示的数据保持不变,
通常在angularjs中,通过向select元素中使用的数组添加一行,select元素会立即使用额外的选项进行更新,但是当我替换整个表时,它就不起作用了,这是一种解释还是一种在更改数据后重新呈现表格的方法?

Angular不知道在单击中发生的模型更新。使用
$apply

$("#graph_canvas").bind("plotclick", function (event, pos, item) {
    $scope.$apply(function(){
        if(item){
            switch(item.series.data[item.dataIndex][0]){
                case 'airtime':
                    $scope.tableData = $scope.airtimeData;
                    break;
                case 'clothing':
                    $scope.tableData = $scope.clothing;
                    break;
                case 'foods':
                    $scope.tableData = $scope.foods;
                    break;
            }
            alert("1st item: " + $scope.tableData[0].name);
        }
    });
});

如果您使用的是Jquery 1.7或更高版本,请使用
.on()
而不是
.bind()
,始终使用所使用的库或框架进行更新:)再次感谢!我会尽快试用,然后再给你回复。美好的
$("#graph_canvas").bind("plotclick", function (event, pos, item) {
    $scope.$apply(function(){
        if(item){
            switch(item.series.data[item.dataIndex][0]){
                case 'airtime':
                    $scope.tableData = $scope.airtimeData;
                    break;
                case 'clothing':
                    $scope.tableData = $scope.clothing;
                    break;
                case 'foods':
                    $scope.tableData = $scope.foods;
                    break;
            }
            alert("1st item: " + $scope.tableData[0].name);
        }
    });
});