<!-- ng-repeat 遍历数组 --> <ul> <li ng-repeat="item in myAarray">{{item}}</li> </ul> <ul> <li ng-repeat-start="user in users">{{user.name}}</li> <li ng-repeat-end>{{user.email}}</li> </ul> <!-- ng-repeat map遍历 --> <ul> <li ng-repeat="(key,value) in myMap">{{key}} | {{value}}</li> </ul> <!-- 当isActive为真的时候class为active 相反则为inActive --> <div ng-class="{true: ‘active‘, false: ‘inActive‘}[isActive]"></div> <!-- 当 isSelected = true 则增加selected class 当isCar = true 则增加car class--> <div ng-class="{‘selected‘: isSelected, ‘car‘: isCar}"></div>
时间: 2024-10-23 03:12:22