首页 > 代码库 > ng-class

ng-class

//json
<p ng-class="{red:a,text:b,dec:c}">Test Demo</p>
<input type="checkbox" ng-model="a">红 <br>
<input type="checkbox" ng-model="b">粗 <br>
<input type="checkbox" ng-model="c">中划线 <hr>
//
<p ng-class=style>Test Demo</p>
<input type="text" ng-model="style"><hr>
//数组
<p ng-class="[style1,style2,style3]">Test Demo</p>
<input ng-model="style1" placeholder="red text or dec" aria-label="red text or dec"> <br>
<input ng-model="style2" placeholder="red text or dec" aria-label="red text or dec">粗 <br>
<input ng-model="style3" placeholder="red text or dec" aria-label="red text or dec">中划线 <hr>
//json和数组
<p ng-class="[style4,{ora:d}]">Test Demo</p>
<input ng-model="style4" placeholder="text or dec" aria-label="text or dec"> <br>
<input type="checkbox" ng-model="d">

ng-class