简体   繁体   中英

I need to open a particular accordion group on click of a button

For example: How to open a 2nd accordion group if i pass a particular value to a function. Below is my html code.

<uib-accordion-group ng-repeat="(menu,submenu) in leftNavData.leftNav" is-open="$first">
  <uib-accordion-heading>
    <span ng-click="location(submenu.url)">{{menu}}</span><i class="pull-right bold" ng-class="{'icon-downArrow': openIndex[$index], 'icon-fti_rightArrow': !openIndex[$index]}"></i>
  </uib-accordion-heading>
  <ul>
    <li ng-repeat="value in submenu" ng-click="subMenuOpen($event)"><a ui-sref="{{value.url}}">{{value.text}}</a></li>
  </ul>
</uib-accordion-group>

From what I understood, this plunker should help you.Let me know if this isn't what you need. Note that I've used:

ng-click="selection($index)" is-open="check($index)" 

to handle it.

Try passing accordion index using $scope.userVal in your controller.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM