Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i determine first row of html table using angular?

Tags:

html

angularjs

I can think of a few hacky ways, but for example below in my doSomething method, how can i determine the rowIndex?

        <tr ng-repeat="a in mydata">
            <td><b>{{doSomething(mydata.name)}}</b></td>
            <td>{{age}}</td>
            <td>hello</td>
        </tr>
like image 490
schmoopy Avatar asked Nov 19 '25 01:11

schmoopy


1 Answers

ng-repeat provides properties $first, $index, $middle, and $last. Since in the title question you asked about the first row, you could pass $first as a boolean:

<tr ng-repeat="a in mydata">
    <td><b>{{doSomething($first)}}</b></td>
    <td>{{a.age}}</td>
    <td>hello</td>
</tr>
like image 127
Mark Rajcok Avatar answered Nov 21 '25 17:11

Mark Rajcok