我是角的初学者。我试着用棱角材料标签做些事情。我将选项卡部分添加到图像中,但该部分不起作用。有没有人知道如何将图像添加到“角度材料”选项卡。请看一看我的附图,了解我的努力实现什么。

我的代码部分:
<mat-tab-group mat-stretch-tabs class="example-stretched-tabs mat-elevation-z4">
<mat-tab label="First" style="background:url('/assets/img/school-01.png')"> Content 1 </mat-tab>
<mat-tab label="Second"> Content 2 </mat-tab>
<mat-tab label="Third"> Content 3 </mat-tab>
</mat-tab-group>css
.example-stretched-tabs {
max-width: 800px;
}
/* active tab */
.mat-tab-list .mat-tab-labels .mat-tab-label-active {
color:#0f2241;
background-color: #535353;
opacity: 1;
}
/* ink bar */
.mat-tab-group.mat-primary .mat-ink-bar {
background: none;
content: url('https://image.flaticon.com/icons/svg/60/60995.svg');
height: 10px;
}.ts
import {Component, ViewEncapsulation} from '@angular/core';
/**
* @title Tab group with stretched labels
*/
@Component({
selector: 'tab-group-stretched-example',
templateUrl: 'tab-group-stretched-example.html',
styleUrls: ['tab-group-stretched-example.css'],
encapsulation: ViewEncapsulation.None
})
export class TabGroupStretchedExample {}发布于 2018-09-14 08:37:48
根据角文档
对于更复杂的标签,在mat选项卡中添加一个带有mat标签指令的模板。
因此,您可以将您的<img>或任何您想要的东西放到模板<ng-template mat-tab-label/>中。
<mat-tab-group>
<mat-tab>
<ng-template mat-tab-label>
<img src="...">
<span>foo</span>
</ng-template>
</mat-tab>
<mat-tab>
....
</mat-tab>
</mat-tab-group>https://stackoverflow.com/questions/52325669
复制相似问题