gpt4 book ai didi

angularjs - 模糊除选定项之外的所有列表项

转载 作者:行者123 更新时间:2023-11-28 05:11:23 25 4
gpt4 key购买 nike

我有一个元素列表。当您单击一项时,它会展开。我想模糊除扩展项之外的所有列表项。

<li href="#" class="list-group-item" ng-repeat="task in taskVm.tasksdata | orderBy: 'NAME' | filter: search | statusFilter: taskVm.statusArray">
<div class="row" ng-click="task.isCollapsed = !task.isCollapsed">
<div class="col-md-5">
<lable>[[::task.NAME]] </lable>
</div>
<div class="col-md-5 offset-md-1">
<lable ng-class="taskVm.getStateClass(task.STATUS)">[[::task.STATUS]] </lable>
</div>
<div class="col-md-2">
<i ng-click="taskVm.openAlternativeTask(task)" class="fa fa-question-circle-o fa-stack-1x pull-right"></i>
</div>
</div>
<div uib-collapse="task.isCollapsed">
<hr>
<div class="row">
<lable>[[::task.MESSAGE]] </lable>
</div>
<div class="row">
<div class="row" ng-hide="task.M.length ===0">
<hr>
<label>Alternatives</label>
</div>
<div class="row">
<ul class="alternatives-list list-group">
<li class="list-group-item" ng-repeat="alternative in task.M" ng-click="showAlternative(alternative.ID, alternative.SETNUMBER); taskVm.setSelected(alternative.SETNUMBER)" ng-class="{selected: alternative.SETNUMBER === taskVm.idSelectedVote}">[[alternative.SETNAME]]</li>
</ul>
</div>
</div>
</div>
</li>

这是我的 list

最佳答案

它将把测试类应用到除第一个进入 ng-repeat 之外的所有 div

<div ng-class="{'test': !$first}"></div>

查看工作示例,这将帮助您完成代码中的其余操作。当您单击某个元素时,它只会更改该元素的类。

var myApp = angular.module('myApp',[]);
myApp.controller('MainCtrl', function($scope) {
$scope.items = [
{ name: 'Item 1' },
{ name: 'Item 2' },
{ name: 'Item 3' },
{ name: 'Item 4' },
{ name: 'Item 5' }
];
$scope.selected = 0;
$scope.select= function(index) {
$scope.selected = index;
};
});
.blur
{
color:red;
}
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<body ng-app="myApp" ng-controller="MainCtrl">
<ul>
<li ng-repeat="item in items track by $index">
<a ng-click="select($index)" ng-class="{blur: $index == selected}">{{item.name}}</a>
</li>
</ul>
</body>

关于angularjs - 模糊除选定项之外的所有列表项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39530514/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com