樣式
<div ng-style="{width: 100 + 'px', height: 100 + 'px', backgroundColor: 'red'}">
</div>
類
<div ng-controller="TestCtrl" ng-class="cls">
</div>
顯示和隱藏
ng-show ng-hide ng-switch
前兩個(gè)是控制 display 的指令:
<div ng-show="true">1</div>
<div ng-show="false">2</div>
<div ng-hide="true">3</div>
<div ng-hide="false">4</div>
后一個(gè) ng-switch 是根據(jù)一個(gè)值來決定哪個(gè)節(jié)點(diǎn)顯示锐秦,其它節(jié)點(diǎn)移除:
<div ng-init="a=2">
<ul ng-switch on="a">
<li ng-switch-when="1">1</li>
<li ng-switch-when="2">2</li>
<li ng-switch-default>other</li>
</ul>
</div>
其他屬性
ng-src 控制 src 屬性:
<img ng-src="{{ 'h' + 'ead.png' }}" />
ng-href 控制 href 屬性:
<a ng-href="{{ '#' + '123' }}">here</a>
ng-src src屬性
ng-href href屬性
ng-checked 選中狀態(tài)
ng-selected 被選擇狀態(tài)
ng-disabled 禁用狀態(tài)
ng-multiple 多選狀態(tài)
ng-readonly 只讀狀態(tài)