Components: There is no directive with "exportAs" set to "routerLinkActive"

Created on 23 Nov 2017  路  3Comments  路  Source: angular/components

I am using the material angular tab nav list component in my application, it's working as expected but while executing the test case throws error.

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>

Error Message:
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"

May I know why this error on only spec.

Most helpful comment

All 3 comments

The routerLinkActive directive is defined in the RouterModule. You probably forgot to include it in your testing module, which is why it ends up throwing.

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mmalerba picture mmalerba  路  127Comments

jelbourn picture jelbourn  路  171Comments

julianobrasil picture julianobrasil  路  78Comments

Daugoh picture Daugoh  路  79Comments

MariovanZeist picture MariovanZeist  路  59Comments