I need to open an md dialog containing an md-tab group with two tabs. The md dialog box can be opened with two buttons that should open the corresponding tab. The template from which the md-dialog opens:
<button md-button class="" (click)="openDialog(1)">open tab 1</button>
<button md-button class="" (click)="openDialog(2)">open tab 2</button>
Component .ts:
openDialog(type) {
var data: any = {};
data.type = type;
let dialogRef = this.dialog.open(TwoTabDialog, {height: 'auto', width: '529px', data: data});
dialogRef.afterClosed().subscribe(result => {});
}
And the dialog template:
<md-tab-group class="follow-dialog">
<md-tab label="tab 1" id="followers-tab" md-active="data.type == 1">
tab 1 content
</md-tab>
<md-tab label="tab 2" id="following-tab" md-active="data.type == 2">
tab 2 content
</md-tab>
The problem is that tab 1 opens all the time.
source
share