I would like to change the border color and width of the mat-expansion-panel that has a specific class.
html
<div>
<mat-accordion>
<mat-expansion-panel *ngFor="let item of itemList; let i=index"
[hideToggle]="true"
[class.selected]="item.selected">
<mat-expansion-panel-header>
<mat-panel-title>{{item.header}}</mat-panel-title>
</mat-expansion-panel-header>
{{item.content}}
</mat-expansion-panel>
</mat-accordion>
</div>
ts
import { Component } from '@angular/core';
interface Item {
header: string;
content: string;
selected: boolean;
}
@Component({
selector: 'my-app',
templateUrl: './app.component.html',
styleUrls: [ './app.component.css' ]
})
export class AppComponent {
public itemList: Item[] = [
{
header: 'Item1',
content: 'This is item1.',
selected: false,
},
{
header: 'Item2',
content: 'This is item2.',
selected: true,
}
];
}
css
.selected {
border-width: 2px;
border-color: red;
}
I would like to set the border color red and width 2px for Item2. But the above example does not work.
How can I fix?
