Accordion by default all expand


#1

how do i expand all item in accordion is active

i am using below code

  <ion-list>
    <div ng-repeat="group in groups">
      <ion-item class="item-stable"
                ng-click="toggleGroup(group)"
                ng-class="{active: isGroupShown(group)}">
          <i class="icon" ng-class="isGroupShown(group) ? 'ion-minus' : 'ion-plus'"></i>
        &nbsp;
        Group {{group.name}}
      </ion-item>
      <ion-item class="item-accordion"
                ng-repeat="item in group.items"
                ng-show="isGroupShown(group)">
        {{item}}
      </ion-item>
    </div>
  </ion-list>

</ion-content>

controller.js

$scope.toggleGroup = function(group) {
group.show = !group.show;
};
$scope.isGroupShown = function(group) {
return group.show;
};

from reference

i want to active by default all accordion list item. please help me how do they do it?


#2

Not sure if i understand you correctly. You want to expand all accordions on initial view? Then just change your key “show” to true in your controller.

Updated Pen:


#3

Thank you so much buddy .