[英]How to recognize *ngFor index in td in angular4?
I have an array of dates to loop through which consist of all dates of 4 weeks as shown below: 我有一个循环的日期数组,其中包含4周的所有日期,如下所示:
<table boder="1">
<tr>
<td>First Spot</td>
<td *ngFor="let date of datesFullArray; let i = index;" class="nopadd" [class.no-border]="i+1 % 7 == 0">
<div *ngFor="let gs of firstSpot">
<span [ngClass]="{
'available':checkDate(gs.fromDate, gs.toDate, date) === 1,
'not-available':checkDate(gs.fromDate, gs.toDate, date) === 0
}">
</span>
</div>
</td>
</tr>
</table>
Here, i want to split the <td>
ie when it reaches 1st, 2nd, 3rd weeks i want to apply no-border
class which makes border
as none
. 在这里,我想分割<td>
即当它到达第1、2、3周时,我想应用no-border
类,这使border
为none
。
I am trying to take the index value to do the same but not working.. 我正在尝试使索引值执行相同的操作,但不起作用。
Any help highly appreciated.. 任何帮助,高度赞赏。
To remove the border of td tag 删除td标签的边框
using style binding 使用样式绑定
[style.border]="((i+1) % 7) == 0 && 'none'">
or class 或课程
[class.no-border]="((i+1) % 7) == 0">
demo stackblitz 演示堆栈闪电战
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.