ng-class的使用
- js
function Ctr($scope) {
$scope.isActive = true;
}
- html
<div ng-class="{true: ‘active‘, false: ‘inactive‘}[isActive]">
</div>
时间: 2024-12-20 23:45:45
function Ctr($scope) {
$scope.isActive = true;
}
<div ng-class="{true: ‘active‘, false: ‘inactive‘}[isActive]">
</div>