I try to put the two tabs into two separate components like the following:
<mat-tab-group animationDuration="0ms">
<mat-tab app-tab [label]="'blabla1'" [data]="aaaData"></mat-tab>
<mat-tab app-tab [label]="'blabla2'" [data]="bbbData"></mat-tab>
</mat-tab-group>
...
@Component({
selector: 'mat-tab[app-tab]',
templateUrl: './tab.component.html',
styleUrls: ['./tab.component.scss']
})
export class TabComponent {
@Input() label: string;
@Input() data: any;
and in module.ts:
import {MatTabsModule} from '@angular/material';
@NgModule({
imports: [
MatTabsModule,
And I get the error:
Uncaught Error: Template parse errors: More than one component matched on this element. Make sure that only one component's selector can match a given element. Conflicting components: MatTab,TabComponent ("
Or, if I use a mat-tab-link
instead of mat-tab
, and a[mat-tab-link][app-tab]
instead of mat-tab[app-tab]
, I will get the
Uncaught Error: Template parse errors: Can't bind to 'data' since it isn't a known property of 'a'. ("mat-tab-group animationDuration="0ms">
and it doesn't support the label
property either:
Uncaught Error: Template parse errors: Can't bind to 'label' since it isn't a known property of 'a'. ("s="tabs-wrap">][label]="'blabla1'" [data]="aaaData">