gpt4 book ai didi

angularjs - 是否可以将 angular aria 用于 aria-expanded?

转载 作者:行者123 更新时间:2023-12-01 00:45:46 24 4
gpt4 key购买 nike

我在互联网和 Angular Aria 文档上进行了搜索——它没有提到 aria-expanded 或 aria-selected?

有没有办法实现这个?

<a href ng-aria={'expanded': selected} & ng-aria={'selected': selected}></a>

这将使:
<a href aria-expanded="true" aria-selected="true"></a>

谢谢。

最佳答案

我使用 ng-bootstrap 来做到这一点。例如:

HTML

<p>
<button type="button" class="btn btn-outline-primary" (click)="isCollapsed = !isCollapsed"
[attr.aria-expanded]="!isCollapsed" aria-controls="collapseExample">
Toggle
</button>
</p>
<div id="collapseExample" [ngbCollapse]="isCollapsed">
<div class="card">
<div class="card-body">
You can collapse this card by clicking Toggle
</div>
</div>
</div>

typescript
import { Component } from '@angular/core';

@Component({
selector: 'ngbd-collapse-basic',
templateUrl: './collapse-basic.html'
})
export class NgbdCollapseBasic {
public isCollapsed = false;
}

来源: https://ng-bootstrap.github.io/#/components/collapse/examples

关于angularjs - 是否可以将 angular aria 用于 aria-expanded?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34609858/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com