*ngFor

  1. <h2>My Heroes</h2>
  2. <ul class="heroes">
  3. <li *ngFor="let hero of heroes">
  4. <span class="badge">{{hero.id}}</span> {{hero.name}}
  5. </li>
  6. </ul>

*ngIf

  1. <div *ngIf="selectedHero">

ngStyle

  1. <nz-content [ngStyle]="{'height': height+'px'}" style="padding:0 50px;">
  2. </nz-content>

ngClass

  1. [ngClass]="{'text-success':true}"
  1. const arr = [1, 3, 4, 5, 6]
  2. <ul>
  3. <li *ngFor="let item of arr, let i = index">
  4. <span [ngClass]="{'text-danger': i==0}">{{item}}</span>
  5. </li>
  6. </ul>
文档更新时间: 2019-06-20 14:21