My end goal is to create a reusable mat-tab-group
component that adds some functionality to be able to close all tabs. I have found a technique for doing this here:
https://stackoverflow.com/a/53818913/811277
My next set was to wrap the functionality so it can be turned into a re-usable component. I have tried using the technique found here:
Angular Material Tabs not working with wrapper component
In the end I'm having trouble creating an empty MatTab
component to insert at the beginning my list of MatTabs.
I've created a StackBlitz for this:
https://stackblitz.com/edit/angular9-material-baseline-nns7wc
public ngAfterViewInit() {
const matTabsFromQueryList = this._allTabs.map((tab) => tab.matTab);
const list = new QueryList<MatTab>();
// Create & Prepend a new MatTab here?
list.reset([matTabsFromQueryList]);
this._tabBodyWrapper._tabs = list;
}
I was hoping to just create a MatTab component in the code above, but it isn't as simple as just saying new MatTab();