Alex Pappas
Alex Pappas

Reputation: 2608

Can't bind to 'active' since it isn't a known property of 'mat-tab'

I'm having this error even if I imported MatTabsModule.

here's how my component looks like:

@Component({
selector: 'app-settings-page',
template: `
<mat-tab-group animationDuration="0ms">
  <mat-tab
    *ngFor="let routeLink of routeLinks; let i = index;"
    [label]="routeLink.label"
    [routerLink]="routeLink.link"
    [active]="activeLinkIndex === i">
  </mat-tab>
</mat-tab-group>
<router-outlet></router-outlet>`
})

Upvotes: 3

Views: 5987

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222582

As i see the problem here is using <mat-tab-group>, remove that part and it should work fine.

  <mat-tab
    *ngFor="let routeLink of routeLinks; let i = index;"
    [label]="routeLink.label"
    [routerLink]="routeLink.link"
    [active]="activeLinkIndex === i">
  </mat-tab>

Upvotes: 2

Related Questions