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>