问题
I am currently using angular material tabs and I wish to add text before the tabs and also add a drop down list at the end of the row after the tabs. Ideally it should looks something like the following picture:
I tried putting a label or creating a div beside the tabs, however those are not showing. In the end, I created another tab and set it to disabled but I think this is not ideal and I couldn't change the disabled text colour. As for the drop down list I have no clue how to go about it.
I have a demo on stackblitz HERE
How do I customize the tab row and add text or dropdown list in it?
回答1:
You could use absolute position to achieve what you want. You won't be able to do better than this because the component you are using mat-tab-group does not have the option to pass a component in input to display where you want.
So if you want to show something inside mat-tab-group that is not part of mat-tab-group, you have to use absolute position.
I updated your stackblitz here
Note: your disabled Tab trick is very good also, it's a trick but sometimes you have to do some tricks
来源:https://stackoverflow.com/questions/58519190/angular-material-tabs-how-to-customize-tab-row-and-add-text-or-dropdown-list