How can I make by default accordion to make open first element?

Michael

I use bootstrap accordion in my project.

Here is working fiddler .

Here is HTML code:

<div ng-app="myapp">
  <div ng-controller="AccordionDemoCtrl">
    <uib-accordion close-others="oneAtATime">
      <uib-accordion-group ng-repeat="group in groups" is-open="isOpen">
                      <uib-accordion-heading>
                    <div class="text-center">
                        <strong>{{group.title}}</strong>
                        <i class="pull-right glyphicon" ng-class="{'glyphicon-chevron-down': isOpen, 'glyphicon-chevron-right': !isOpen}"></i>
                    </div>
                </uib-accordion-heading>
      {{group.content}}</uib-accordion-group>
    </uib-accordion>
  </div>
</div>

Here is controller:

var app = angular.module('myapp', ['ui.bootstrap', 'ngAnimate'])

app.controller('AccordionDemoCtrl', function($scope) {
  $scope.groups = [{
    title: "Dynamic Group Header - 1",
    content: "Dynamic Group Body - 1"
  }, {
    title: "Dynamic Group Header - 2",
    content: "Dynamic Group Body - 2"
  }, {
    title: "Dynamic Group Header - 3",
    content: "Dynamic Group Body - 3"
  }];
});

I tryed to use this row:

  is-open="true"

Like that:

  <uib-accordion-group heading="{{group.title}}" ng-repeat="group in groups"  is-open="true">{{group.content}}</uib-accordion-group>

But it opens by default all items.

How can I make by default accordion to make open only first element?

P.S. Here is updated plunker

Pankaj Parkar

Do take use of $first of ng-repeat directive to open only 1st accordion like is-open="$first"

Markup

<uib-accordion close-others="oneAtATime">
  <uib-accordion-group heading="{{group.title}}" 
     ng-repeat="group in groups" 
     is-open="$first">
       {{group.content}}
  </uib-accordion-group>
</uib-accordion>

Preview Here

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to make this accordion expanded by default

From Dev

How can I make a default parameter in Typescript?

From Dev

How can I make "gradle --stacktrace" the default?

From Dev

How can I make a default parameter in Typescript?

From Dev

How can I make Shutter open at startup?

From Dev

How can I make Shutter open at startup?

From Dev

How to make <select> element not to choose first option as selected by default?

From Dev

How can i make 'image' key the first?

From Dev

How can I make Notepad++ use ".txt" files as the default open file dialog filter?

From Dev

How can I make PCManFM open plain text files with Leafpad by default in Lubuntu?

From Dev

How can I make a WIN 10 desktop shortcut open a link in Edge, even though Chrome is the default browser?

From Dev

How can I make an autorun to make a program open a file automatically

From Dev

How can I make it so the first element in a DIV has a different CSS to others?

From Dev

Make accordion closed by default in Bootstrap

From Dev

How to make the accordion effect?

From Dev

how to make an accordion in jquery

From Dev

How to make the accordion effect?

From Dev

Yii2 Accordion, how to make first tab inactive

From Dev

How can I make my icon stay in the center of my accordion header?

From Dev

How can I make Bootstrap 3 collapsed accordion panels load at top of their content instead of halfway down?

From Dev

How can I make Bootstrap 3 collapsed accordion panels load at top of their content instead of halfway down?

From Java

How can I make the memberwise initialiser public, by default, for structs in Swift?

From Dev

How can I make 'bundle init' include gems by default?

From Dev

How can I make a custom environment in rails a default environment?

From Dev

How can I make ESS to split window horizontally by default?

From Dev

How can I make all fields in Django admin not required by default?

From Dev

How can I make Javascript parameters default to something if not present?

From Dev

How can I make LightDM the default display manager?

From Dev

How can I make bootstrap multiselect optgroups collapse by default?

Related Related

  1. 1

    How to make this accordion expanded by default

  2. 2

    How can I make a default parameter in Typescript?

  3. 3

    How can I make "gradle --stacktrace" the default?

  4. 4

    How can I make a default parameter in Typescript?

  5. 5

    How can I make Shutter open at startup?

  6. 6

    How can I make Shutter open at startup?

  7. 7

    How to make <select> element not to choose first option as selected by default?

  8. 8

    How can i make 'image' key the first?

  9. 9

    How can I make Notepad++ use ".txt" files as the default open file dialog filter?

  10. 10

    How can I make PCManFM open plain text files with Leafpad by default in Lubuntu?

  11. 11

    How can I make a WIN 10 desktop shortcut open a link in Edge, even though Chrome is the default browser?

  12. 12

    How can I make an autorun to make a program open a file automatically

  13. 13

    How can I make it so the first element in a DIV has a different CSS to others?

  14. 14

    Make accordion closed by default in Bootstrap

  15. 15

    How to make the accordion effect?

  16. 16

    how to make an accordion in jquery

  17. 17

    How to make the accordion effect?

  18. 18

    Yii2 Accordion, how to make first tab inactive

  19. 19

    How can I make my icon stay in the center of my accordion header?

  20. 20

    How can I make Bootstrap 3 collapsed accordion panels load at top of their content instead of halfway down?

  21. 21

    How can I make Bootstrap 3 collapsed accordion panels load at top of their content instead of halfway down?

  22. 22

    How can I make the memberwise initialiser public, by default, for structs in Swift?

  23. 23

    How can I make 'bundle init' include gems by default?

  24. 24

    How can I make a custom environment in rails a default environment?

  25. 25

    How can I make ESS to split window horizontally by default?

  26. 26

    How can I make all fields in Django admin not required by default?

  27. 27

    How can I make Javascript parameters default to something if not present?

  28. 28

    How can I make LightDM the default display manager?

  29. 29

    How can I make bootstrap multiselect optgroups collapse by default?

HotTag

Archive