我尝试从Firebase检索数据以进行查看。所以我在databse sizeofGroups_1,sizesofGroups_2 ....中有一个属性。所以我想使用NgFor获得此属性。我已经尝试了一点。现在我想使用这样的方式。 {{std.sizesofGroups _ {{item}}}}
这是HTML
<ng-container *ngFor="let std of stdlist | paginate: { itemsPerPage: 7, currentPage: p }; let i = index;">
<tr class="table-striped">
<td>{{std.registeredYear}}</td>
<td>{{std.course}}</td>
<td>{{std.groupName}}</td>
<td>{{std.numberofGroups}}</td>
<td>
<ul style="list-style-type:disc;" *ngFor="let item of createRange(std.numberofGroups);" >
<li >{{std.sizeofGroups_+(item)}}</li> //here is the error
</ul>
</td>
<td>
<a class="action-btn" style="color:rgb(36, 143, 192); cursor: pointer" (click)="onEdit(std)">
<i class="material-icons">edit</i>
</a>
<a class="action-btn" style="color:lightcoral; cursor: pointer" (click)="onDelete(std.id)">
<i class="material-icons">delete</i>
</a>
</td>
</tr>
</ng-container>
这是ts
createRange(number){
var items: number[] = [];
for(var i = 1; i <= number; i++){
items.push(i);
}
return items;
}
我想念什么?
答案 0 :(得分:0)
template<class Container>
void push_back(Container& con) {
}
template<class Container , class T,class... Args>
void push_back(Container& con, T tail, Args... args ) {
con.push_back(tail);
std::cout << (tail) << std::endl;
push_back(con, args...);
}
int main()
{
std::vector<int> v_int;
push_back(v_int,1,2,3,4 );
std::cout << "Hello World!\n";
for (auto x : v_int)
std::cout << "=== " << x << " ===" << std::endl;
}
以这种方式工作:)