我想創建一個方法,該方法在檢查複選框時從表格中接收一個Id,並更新角度控制器中的$ scope.selected。 並且當複選框未被檢查時,它應該再次從$ scope.selected中移除它。使用AngularJS的表格中的複選框選擇
到目前爲止,它看起來像這樣:
$scope.updateselection = function(id) {
if ($scope.selected(sort_id) != id) { //what is the correct syntax here??
$scope.selected.push({ sort_id: id });
} else {
$scope.selected.remove({ sort_id: id });
}
};
而問題是? – 2014-09-24 08:10:17
$ scope.selected(sort_id)!= id(這裏有什麼正確的語法?) – ShaqCode 2014-09-24 08:14:51