angular - how to set Index for angular2 -
<template ngfor let-item [ngforof]="faculytlecturemaster" > <tr *ngif="item.subjectname != 'break' && item.facultyname != 'na'" (click)="onlectureclick(item,0)" [class.selected]="item === _selectedhero" > <td> **set index number here** </td> <td>{{item.lectstart}}-{{item.lectend}}</td> <td>{{item.facultyname}}</td> <td>{{item.subjectname}}({{item.subjectcode}})</td> <td>{{item.attendtotal}}</td> <td>{{item.present}}</td> <td>{{item.absent}}</td> <td>{{item.section}}</td> </tr> </template>
i want set index template in angular2
$index
in angular1
i searched got solutions *ngfor="let item of _studentlist let i=index"
work normal in template how use?
how it?
if define index let-i=index
, in case in ngfor, print index with: {{i}}
try one, should work:
<template ngfor let-item [ngforof]="faculytlecturemaster" let-i="index" > <tr *ngif="item.subjectname != 'break' && item.facultyname != 'na'" (click)="onlectureclick(item,0)" [class.selected]="item === _selectedhero" > <td>{{i}}</td> <td>{{item.lectstart}}-{{item.lectend}}</td> <td>{{item.facultyname}}</td> <td>{{item.subjectname}}({{item.subjectcode}})</td> <td>{{item.attendtotal}}</td> <td>{{item.present}}</td> <td>{{item.absent}}</td> <td>{{item.section}}</td> </tr> </template>
more info here
Comments
Post a Comment