NgSwitch 的语法比较啰嗦,使用频率小一些。<div [ngSwitch]="currentHero"> <div *ngSwitchCase="'Windstorm'">Windstorm</div> <div *ngSwitchCase="'Bombasto'">Bombasto</div> <div *ngSwitchCase="'Magneta'">Magneta</div> <div *ngSwitchDefault>Tornado</div></div>