Franco Manzur
Franco Manzur

Reputation: 373

Angular mobile - accordion open/close

Hi guys i'm using angular mobile framework and i had implemented the accordion. The thing is that by default when you click on it, it opens and if i click the same component again it doesn't close.

Here is the online example. http://mobileangularui.com/demo/#/accordion.

What i need is to be able to open it and close it like most of the accordions component. I tried is.open="" but it did't work.

Upvotes: 1

Views: 174

Answers (1)

Sebastian F
Sebastian F

Reputation: 36

It is design to only open, because of this line of code:

ui-set="{'myAccordion': i}"

So when you click on it again, it just restates that this tab should be open.

What you need to do is check if the item clicked on is already the opened one, and if true, then just set it to some outside value.

ui-set="{ 'myAccordion': Ui.get('myAccordion') == item ? -1 : item }"

Upvotes: 1

Related Questions