Accordion: Restrict expanding to button click in heading
I have an <accordion-heading> tag in my accordion with a couple controls inside (inputs, buttons, etc.), but I only want the accordion to expand when one specific button is clicked. Nothing else should trigger the expand/collapse. It doesn't seem there is a way to do this.
I've tried:
- Setting is-open to false and setting it to true in the
ng-clickof my button. Doesn't work because clicking anywhere inside the accordion-heading toggles this boolean. - Setting is-disabled to true and then setting it to false when the button is clicked. Also doesn't work, the accordion stays disabled
- Wrapping ONLY my button with the
<accordion-heading>tag. This causes the rest of the markup in my heading to part of the 'expand/collapse' detail.
https://github.com/angular-ui/bootstrap#support
What is the resolution? I did not see any further information in the link: https://github.com/angular-ui/bootstrap#support
I figured it out....
set the is-disabled to true for the accordion-group, such as:
<accordion-group is-disabled="true" is-open="status-open">
Then create an accordion-heading and add an ng-click to a specific text or element, such as:
<accordion-heading>
Accordion Heading <button class="btn btn-primary" ng-click="open()">Open</button>
</accordion-heading>
@pedro-meza The solution works like a charm:):):) How does is-disabled in accordion-group relate to ng-click in accordion-heading?
Thank you
@aswini-19aug The status-open is just a scope variable that is set to true or false in the open() function.
@pedro-meza it works fine, thanks for snippet