gpt4 book ai didi

javascript - 事件精确路由器链接演示?

转载 作者:太空宇宙 更新时间:2023-11-04 15:34:23 25 4
gpt4 key购买 nike

angular router文档包含以下有关如何使事件路由器链接准确的代码片段:

The RouterLinkActive directive toggles css classes for active RouterLinks based on the current RouterState. This cascades down through each level of the route tree, so parent and child router links can be active at the same time. To override this behavior, you can bind to the [routerLinkActiveOptions] input binding with the { exact: true } expression. By using { exact: true }, a given RouterLink will only be active if its URL is an exact match to the current URL.

有人有精确路由器链接的演示吗?

最佳答案

在下面的示例中,active-link 类将仅当 URL 为 /inbox 时才添加,而不是 /inbox/33

<a [routerLink]="/inbox" 
routerLinkActive="active-link"
[routerLinkActiveOptions]="{exact: true}">
Inbox
</a>

关于javascript - 事件精确路由器链接演示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44526521/

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