我想在表格单元格中添加不同样式的多行。不过,Angular Material 表似乎剥离了我的 HTML 代码。我怎样才能在Gitlab中实现类似的东西,其中一行/项目内的第一行(例如“管理员”)的样式与第二行(例如电子邮件地址)的样式不同,如代码示例所示。
<ng-container matColumnDef="name">
<mat-header-cell *matHeaderCellDef>{{header}}</mat-header-cell>
<mat-cell *matCellDef="let row">
<!-- first approach -->
<div class="firstline">{{row.firstline}}</div>
<div class="secondline">{{row.secondline}}</div>
<!-- second approach -->
<multiline-component [firstline]="row.firstline" [secondline]="row.secondline"></multiline-component>
</mat-cell>
</ng-container>
Run Code Online (Sandbox Code Playgroud)
<div class="firstline">{{firstline}}</div> // I want to be bold
<div class="secondline">{{secondline}}</div> // I want to be just regular
Run Code Online (Sandbox Code Playgroud)
我尝试将 [innerHTML] 与 bypassSecurityTrustHtml()-Pipe 一起使用,以防止剥离失败。我还尝试使用具有 [firstline] 和 [secondline] 属性绑定的自定义组件。