gpt4 book ai didi

angular - 没有将 "exportAs"设置为 "routerLinkActive"的指令

转载 作者:行者123 更新时间:2023-12-02 14:13:34 27 4
gpt4 key购买 nike

我在应用程序中使用垫导航列表组件来实现选项卡和导航目的。它在前端完美运行,但在测试用例上抛出错误。

Getting the below error from karma.

 There is no directive with "exportAs" set to "routerLinkActive" ("        *ngFor="let tab of tabs"
[routerLink]="tab.path"
[routerLinkActive] [ERROR ->]#rla="routerLinkActive"
[active]="rla.isActive"
selectedIndex="0"

component.html

<nav mat-tab-nav-bar>
<a
mat-tab-link
*ngFor="let tab of tabs"
[routerLink]="tab.path"
[routerLinkActive] #rla="routerLinkActive"
[active]="rla.isActive"
selectedIndex="0"
>
<i class="{{tab.icon}}"></i>
{{ tab.label }}
</a>
</nav>

最佳答案

引用 Angular 4 Error: No provider for ChildrenOutletContexts in Karma-Jasmine Test线程添加了 RouterTestingModule。

解决了 karma 错误。

关于angular - 没有将 "exportAs"设置为 "routerLinkActive"的指令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47449989/

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