Angular2可访问性问题: 屏幕阅读器Nvda工具公告如下。 员工姓名彼得请求复选框未选中未选中如何使用aria-labelledby for * ng在Angular2中为屏幕阅读器公告提供可访问性
应该宣布汤姆第二个值 员工姓名彼得请求复选框,预期结果:未选中 员工姓名汤姆请求复选框。 如何解决这个问题?
employees array in component.ts file as below.
employees= [
{ "id":1, "name": "Peter", "age":32},
{ "id":2, "name": "Tom", "age":28}
];
component.html file as below:
<div class="row">
<div class="col-md-6">
<label id="empName">Employee Name</label>
</div>
<div class="col-md-6">
<label id="request">request</label>
</div>
</div>
<div *ngFor="let emp of employees; let i = index;" class="row">
<div class="col-md-6">
<span id="name">{{emp.name}}</span>
</div>
<div class="col-md-6">
<input type="checkbox" aria-labelledby="empName name request" />
</div>
</div>