我有一个展开和折叠列表,我基于一个示例https://forum.ionicframework.com/t/accordion-list/2832。
我的列表是选项列表,然后搜索。问题是我搜索时会从展开变为崩溃。当我第二次搜索时,它会从崩溃变为再次扩展。
我想要的是:
以下是我的HTML
<div class="item" ng-click="toggleGroup(group)"
ng-class="{active: isGroupShown(group)}">
<i class="icon" ng-class="isGroupShown(group) ? 'ion-
minus' : 'ion-plus'"></i>
<div class="row">
<div class="col boldText">Investment</div>
</div>
<div class="item" ng-if="isGroupShown(group)">
<div class="row centerized">
<div class="col col-40"></div>
<div class="col col-30">Min</div><div class="col col-30">Max</div>
</div>
<div class="row">
<div class="col col-40">Amount</div>
<div class="col col-30"><input type="number" placeholder="0" ng-model="searchQuery.yaMin"></div>
<div class="col col-30"><input type="number" placeholder="5" ng-model="searchQuery.yaMax"></div>
</div>
</div>
</div>
JavaScript的:
$scope.toggleGroup = function(group) {
if ($scope.isGroupShown(group)) {
$scope.shownGroup = null;
} else {
$scope.shownGroup = group;
}
};
$scope.isGroupShown = function(group) {
return $scope.shownGroup === group;
};
以下是jsddile(第一次使用) https://jsfiddle.net/fhmLLa4u/