I am using ng-repeat in table for generating the table rows dynamically. I need to call a function with "this" keyword when user clicks on a check box in the table. When I am passing this as an argument its coming undefined on the js side. please help me below is my code
<table class="codelisttab">
<tr><th></th><th>Employee Name</th><th>Employee Id</th></tr>
<tr data-ng-repeat="emp in employees">
<td style="width:20px;"><a data-ng-click="updateEmployeeList(emp.empid, this)" class="ui-multiselect-box commonMultiSelectClass unCatMultiselectColorSelected" id="unCatMulti_109812"></a></td>
<td>{{emp.name}}</td><td>{{emp.empid}}</td>
</tr>
<tr colspan="3"><th style="text-align:center;"><input type="button" data-ng-click="addGroup()" value="Create Group"></th></tr>
My js code:
$scope.updateEmployeeList = function(empid, obj){
var i = $scope.employeeList.indexOf(empid);
if(i <= -1){
$scope.employeeList.push(empid);
obj.style.backgroundColor="#89e3f9";
}
else{
obj.style.backgroundColor="#0e5061";
$scope.employeeList.splice(i,1);
}
console.log($scope.employeeList.toString());
}