【发布时间】:2020-03-02 10:46:41
【问题描述】:
学生想要注册一门或多门课程。由于类列表是动态的,因此我使用 ngFor 以表格格式显示,最后带有复选框以选择类。但是,当学生复选框选择班级时,不知道如何获得价值。
我曾尝试使用选择选项,但效果不佳。
<div>
<table align="center" >
<tr class="heading" >
<th style="padding: 5px;">Code</th>
<th style="padding: 5px;">Name</th>
<th style="padding: 5px;">Capacity</th>
<th style="padding: 5px;">Remaining</th>
<th style="padding: 5px;">Location</th>
<th style="padding: 5px;">Instructor</th>
<th style="padding: 5px;">Register?</th>
</tr>
<tr *ngFor="let item of classItem">
<td style="border-right-style: dashed;">{{ item.Code }}</td>
<td>{{ item.Name }}</td>
<td>{{ item.Capacity }}</td>
<td>{{ item.Remaining }}</td>
<td>{{ item.Location }}</td>
<td>{{ item.Instructor }}</td>
<td>
<ion-checkbox style="text-align: center;" (onchange)="checkboxChange()" [(ngModel)]="checkItem"></ion-checkbox>
</td>
</tr>
</table>
我希望当学生注册任何班级时,班级容量将减少一个并更新到 firebase 数据库。
【问题讨论】:
-
如果您认为任何回复都回答了您的问题,请考虑将其标记为已接受,以使未来的读者受益。更多信息:stackoverflow.com/help/someone-answers.
标签: angular typescript firebase ionic-framework checkbox