I'm using Angular v8 and Angular Materials. In particular mat-tab-group and mat-tab. I want to have something like the below. I want to be able to click on the "+" (which looks like a tab) and the result would be that it would create a new tab
After clicking on the "+" we'd see as below (focus is on the new tab we just added)
If I have a button above the mat-tab-group (which adds a new tab) all works fine but we want the "+" to be at the end of the tab list (as shown above). I can get the tab to create but focus doesn't got to it.
My code looks like. In the setSelectedIndex method call I add a new customer object and then set the selectedIndex to it. But no joy. Code sample below. Can try add as a plunkr if needs be
<mat-tab-group
class="no-vertical-scroll"
[disableRipple]="true"
animationDuration="0ms"
(selectedTabChange)="setSelectedIndex($event)"
(focusChange)="onFocusChange($event)"
[selectedIndex]="selectedTabIndex"
style="margin-top: 10px;">
<mat-tab *ngFor="let customer of customers; let index = index"
class="fullHeight no-vertical-scroll no-horizontal-scroll">
<div>
content for each tab
</div>
</mat-tab>
<mat-tab tooltip="New Tab" class="fullHeight no-vertical-scroll" label="New Tab">
<ng-template mat-tab-label class="fullWidth">
<span><mat-icon>add</mat-icon></span>
</ng-template>
</mat-tab>
</mat-tab-group>
Thanks Ro


