0
$scope.toggleSelection = function($index) {
var idx = $scope.employees[$index].id;
var result = $.grep($scope.selection, function(e){ return e.id == idx; });
var flg=true;
var x=0;
for (var i=0; i<$scope.selection.length; i++) {
if ($scope.selection[i].id == idx){
flg = false;x=i;
break;
}
}
if(flg){
$scope.selection.insert($scope.selection.length,$scope.employees[$index]);
}else{
$scope.selection.remove(x);
}
};