bootstrap icon indicating copy to clipboard operation
bootstrap copied to clipboard

Accordian: isOpen fails to work with ngRepeat

Open sudhakar opened this issue 13 years ago • 5 comments

By default I want the first accordian-group to be open when loaded initially. So for that I have set isOpen to true in first accordian like

<accordion-group heading="First Header" is-open="true">

Although this works fine for static content, but when I start adding dynamic content using ngRepeat, it fails.

  <accordion>
    <accordion-group heading="First Header" is-open="true">
      <div ng-repeat="item in items">{{item}}</div>
    </accordion-group>
    <accordion-group heading="Second Header">
      You can toggle to second group ofcourse..
    </accordion-group>
  </accordion>

Here's the plunker http://plnkr.co/edit/YcDRVJ?p=preview

sudhakar avatar Jan 22 '13 15:01 sudhakar

Yes, this is a bug with the way that the collapse is handling its initial transition - it seems to be stuck at height: 19px rather than reverting to height: auto.

petebacondarwin avatar Jan 22 '13 18:01 petebacondarwin

As a work-a-round put the is-open='true' on the last group

johntom avatar Jan 23 '13 15:01 johntom

@johntom Doesnt seems to work for me. Here's plnkr http://plnkr.co/edit/D21gzT?p=preview

sudhakar avatar Jan 23 '13 16:01 sudhakar

Ok, I looked at my example where I use jade and got it working, Idea is to have it fit in one line. Thus items 2 and 3 work with is open while 1 has problem. http://plnkr.co/edit/5Zk5P7?p=preview

johntom avatar Jan 23 '13 22:01 johntom

very useful

smallg avatar Sep 04 '13 06:09 smallg