将 SL 编号添加到角度表
我有下表,其中表中是使用数组生成的:
<tbody *ngFor="let ques of questArray;let i =index">
<tr *ngif="catId == ques.categoryID">
<td> {{i}} </td>
我需要向列添加序列号
但问题是有一个 *ngif 会过滤具有不同类别的数组 因此,如果执行 {{i}},数字现在会列出来
1,2,5,6,7,11
I want to list like 1,2,3,4,5 without break.
同样在新类别中,`
我需要从 1 重新开始编号,而不是继续。
`
我可以使用另一个 *ngFor 作为序列号吗?是否可以在每个 ngif 条件下重新启动该号码
I have the following table where in the table is generated using an array:
<tbody *ngFor="let ques of questArray;let i =index">
<tr *ngif="catId == ques.categoryID">
<td> {{i}} </td>
I need to add a serial number to the column
But the problem is there is an *ngif that will filer the array with different categories
So if do {{i}} the numbers now list like
1,2,5,6,7,11
I want to list like 1,2,3,4,5 without break.
Also in the new category, `
I need to restart numbering from 1 instead of continuing.
`
Can i use another *ngFor for serial number, also is it possible to restart the number is each ngif condition
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 questArray 的元素中添加一个新键。
例如在 ts 文件中,
并在模板中使用它,如下所示,
Add a new key in element of questArray.
For example in ts file,
And use that in template like below,