How can I apply style on some item in a list that satisfy listed condition:
-
You can use this method described further here. (example below)
angular.module('app', []);
function myCtrl($scope){
$scope.items = [
{ name: 'a', selected: 'false' },
{ name: 'b', selected: 'true' }
];
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js"></script>
<html ng-app>
<body ng-controller="myCtrl">
<div ng-repeat="item in items">
<div ng-style="{color: {true:'red'}[item.selected]}">{{item.name}}</div>
</div>
</body>
</html>
讨论(0)