我有:
<md-tab-group color="primary"> <md-tab label="Проэкты"> <h1>Some tab content</h1> </md-tab> <md-tab label="Обучалка"> <h1>Some more tab content</h1> <p>...</p> </md-tab> </md-tab-group>
onLinkClick() { this.router.navigate(['contacts']); }
您可以使用(selectedTabChange)事件.检查
Material2#tabs.
原文链接:https://www.f2er.com/angularjs/143367.html模板:
<mat-tab-group color="primary" (selectedTabChange)="onLinkClick($event)"> ... </mat-tab-group>
零件:
import { MatTabChangeEvent } from '@angular/material'; // ... onLinkClick(event: MatTabChangeEvent) { console.log('event => ',event); console.log('index => ',event.index); console.log('tab => ',event.tab); this.router.navigate(['contacts']); }