Angular2 嵌套 ngFor [英] Angular2 nested ngFor
问题描述
我需要在 Angular2 中做同样的事情:
I need to do an equivalent of this in Angular2:
<?php
foreach ($somethings as $something) {
foreach ($something->children as $child) {
echo '<tr>...</tr>';
}
}
这可以通过 ngFor 实现,而不是在 Can this be achieved with ngFor and not adding new elements between 我有一个可能与您想要的类似的示例: I have a sample that might be similar to what you want: 我用它来渲染一个电子表格网格,如下所示:http://www.syntaxsuccess.com/angular-2-samples/#/demo/spreadsheet I use this to render out a spreadsheet looking grid as seen here: http://www.syntaxsuccess.com/angular-2-samples/#/demo/spreadsheet 这篇关于Angular2 嵌套 ngFor的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! 和
之间添加新元素吗?
<table>
and <tr>
?推荐答案
<table id="spreadsheet">
<tr *ngFor="let row of visibleRows">
<td class="row-number-column">{{row.rowIndex}}</td>
<td *ngFor="let col of row.columns">
<input data-id="{{col.rowIndex}}-{{col.columnIndex}}" [value]="col.cellValue" (input)="col.cellValue = $event.target.value" (click)="model.selectColumn(col)" (keyup)="navigate($event)" />
</td>
</tr>
</table>
登录
关闭