Could just do $scope.table.numSelected = selected ? rowSelected : 0;`