Angular 4.x NgClass ngStyle 指令用法

  1. <some-element [ngClass]="'first second'">...</some-element>
  2. <some-element [ngClass]="['first', 'second']">...</some-element>
  3. <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
  4. <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element>
  5. <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
  1. <div [ngStyle]="{'background-color':'green'}"></<div>  
posted @ 2019-03-20 17:38  一城柳絮吹成雪  阅读(707)  评论(0编辑  收藏  举报