I am making a student report list with Angularjs ng-repeat. My problem If I can dynamically include the serial number in the order sorted in the generated list, respectively. I want to achieve something like this
#. Student's name Student ID _________________________________ 1 | Samuel Edu | 346578 2 | Grace Asumani | 965433 3 Zine Akeel. 123455 4 David Adotte | 678543
'#' column should be automatically generated when presenting the model via NG-Duplah. Honestly I do not know where to start from, because I do not know how to do it. I'm glad that someone can help me or tell me about the right source thanks.
In NG-repeat, you can use:
{{$ Index +1}}
For example:
& lt; Tr ng-repeat = "students in students" & gt; & Lt; Td> # {{$ Index + 1}} & lt; / Td> & Lt; TD & gt; {{Student.name}} & lt; / TD & gt; & Lt; / TR & gt; $ Index is a variable provided by ng-repeat instructions which gives you the current index, here I have added 1 so that the number starts with 1 instead of 1.
No comments:
Post a Comment