I want to get the index of the td from the table which will be dynamic in number of column and rows. So I can't put ng-click on each td.
I get that using jquery like this ...
<table border="1">
<tr>
<td>0</td>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>0</td>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>0</td>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
</table>
<script>
$("table tr").on("click", "td", function(){
var col = this.cellIndex;
//alert(col);
$('table tr').find('td:eq('+col+'),th:eq('+col+')').remove();
});
</script>
So how to get that in my controller
app.controller('MyCtrl1', function($scope){
});
I get a dynamic table from where I need only few column. The $scope i will ng-repeat in the table, I want to edit that dynamical and post that data to database.
data-ng-click=someMethod($index);