I base in this example: http://code.ciphertrick.com/2014/12/06/highlight-a-selected-row-in-ng-repeat-using-ng-class/ Demo: http://code.ciphertrick.com/demo/ngClass/
The example is working ok, but i need to add a button element and when i click in the button, i want to show in a alert, the value of name column, for example "Noodles"
This is my code html:
<table class="table table-hover">
<thead>
<tr>
<th>Branch</th>
<th>Name</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="organizational in organizationals" ng-class="{'selected':$index == selectedRow}" ng-click="setClickedRow($index)">
<td>{{organizational.branch}}</td>
<td>{{organizational.name}}</td>
</tr>
</tbody>
</table>
<button type="button" class="btn btn-default" ng-click="createSelectRowClick();">Select</button>
This is my js code:
$scope.managers = [
{name: 'Ana Faedo Iglesias'},
{name: 'Cristina Menendez'},
{name: 'Daniel Piriz'}
];
$scope.selectedRow = null;
$scope.setClickedRow = function(index){
$scope.selectedRow = index;
}
$scope.createSelectRowClick = function(){
if ($scope.selectedRow==null)
{
alert("Any rows selected");
}
else
{
//alert("valuetd" + value td column name, about click row);
}
}
NOTE: The table is in a modal window, if i click in table row, I recover the value of the column, i close the window modal, and after, i can put the column value wherever.
How could do it? thanks,