Below code is taken from material.angular.io:
<nav mat-tab-nav-bar>
<a mat-tab-link
*ngFor="let link of navLinks"
[routerLink]="link.path"
routerLinkActive #rla="routerLinkActive"
[active]="rla.isActive">
{{link.label}}
</a>
</nav>
<router-outlet></router-outlet>
component:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
navLinks = [
{label: 'Home', path: 'home'},
{label: 'Contacts', path: 'contacts'},
{label: 'Settings', path: 'settings'}
];
}
When i tried to run this sample, the nav requires clicking on home for the component to be opened. I want the contents of home to be displayed initially. How do you set the first value as the default active tab?