This is my code.
I m getting data through ng-repeat and showing it as shown in below code.
What I want is if I click on either of the name then it should ale
You need to modify html and add selectInfo
function in controller file.
html
<table>
<tr ng-repeat="x in record">
<th>{{x.id}}</th>
<th ng-click="selectInfo(x.firstname)"> {{x.firstname}}</th>
<th ng-click="selectInfo(x.middlename)">{{x.middlename}}</th>
<th ng-click="selectInfo(x.lastname)">{{x.lastname}}</th>
</tr>
</table>
code
$scope.selectInfo=function(name){
alert(name);
}
You are going good so far. You added the ng-click event. But aal you need to do to get the name in controller is, you need to paas the current item as arguement
See Here
<th ng-click="selectInfo(x)">{{x.firstname}}</th>
and in the controller make a function
$scope.selectInfo = function (item) {
alert(item.firstname);
// Or use this to do whatever you want
}