有人知道如何在 Angular 2 with Typescript 中实现可访问性吗?
Angular 2 具有Accessibility(ARIA-enabled)功能,但我没有找到任何类型的样本/示例,我搜索了很多但没有找到任何事物。有谁知道如何实现它?
最佳答案
您可以使用所有 aria 属性,方法是使用属性绑定(bind):
<!-- create and set an aria attribute for assistive technology -->
<button [attr.aria-label]="actionName">{{actionName}} with Aria</button>
例如,您可以在 div 容器上使用 aria Angular 色属性,如下所示:
<div [attr.role]="ariaRole">
[attr.role]
将 Angular 色属性绑定(bind)到表达式 ariaRole 的结果。
您可以找到所有可用的 aria-attributes here .
关于javascript - 具有 508 可访问性的 Angular 2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38736189/