根据条件设置新式

[class.selected]="hero === selectedHero"

  1. <li *ngFor="let hero of heroes"
  2. [class.selected]="hero === selectedHero"
  3. (click)="onSelect(hero)">
  4. <span class="badge">{{hero.id}}</span> {{hero.name}}
  5. </li>
文档更新时间: 2019-04-30 12:38