0
我想應用一個類,如果一個值匹配任何一個數組的元素。我的方法如下 -使用數組作爲表達式應用ngClass
sectionHeaders:Array<string>=["Appearance", "Personality and Interests", "Relationships", "In The Anime", "Anime", "Name", "Character Songs", "Trivia"];
<ion-item *ngFor="let info of characterInfo.sections">
<h2 class="heading" [ngClass]='{"redBackground" : info?.title == sectionHeaders}'></h2>
</ion-item>