Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Accordion custom template does not work with data-uib-accordion-heading #5834

Closed
bstoney opened this issue Apr 21, 2016 · 4 comments
Closed

Comments

@bstoney
Copy link

bstoney commented Apr 21, 2016

A custom accordion template does not correctly transclude a heading when used with data- prefix, i.e. data-uib-accordion-header instead of uib-accordion-header

<div data-uib-accordion>
    <div data-uib-accordion-group data-template-url="custom-template.html">
        <div data-uib-accordion-heading>
            Heading <small>Sub heading</small>
        </div>
        <table class="table table-condensed table-striped">
            <thead>
            <tr>
                <th>Name</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>A name</td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
<script type="text/ng-template" id="custom-template.html">
    <div class="panel panel-default">
        <div class="panel-heading pointer" data-ng-click="toggleOpen()">
            <h4 class="panel-title">
                <a href data-uib-accordion-transclude="heading"><span uib-accordion-header data-ng-class="{'text-muted': isDisabled}">{{heading}}</span></a>
            </h4>
        </div>
        <div class="panel-collapse collapse" data-uib-collapse="!isOpen">
            <div data-ng-transclude></div>
        </div>
    </div>
</script>

Changing the template to use the uib-accordion-header does work:

<a href data-uib-accordion-transclude="heading"><span uib-accordion-header data-ng-class="{'text-muted': isDisabled}">{{heading}}</span></a>
@deeg
Copy link
Contributor

deeg commented Apr 21, 2016

Please take the time to follow the issue template and supply version numbers of the libraries you are using along with a plunkr reproducing the issue so we can look into identifying and fixing any bugs.

@RobJacobs
Copy link
Contributor

The querySelector here is looking for the attribute uib-accordion-header.

@wesleycho
Copy link
Contributor

I wish we didn't support this prefix :( .

PRs welcome.

perryhoffman added a commit to perryhoffman/bootstrap that referenced this issue Apr 24, 2016
Fixing uib-accordion-header directive to transclude data properly when it has the 'data-' prefix.

Fixes angular-ui#5834
@bstoney
Copy link
Author

bstoney commented Apr 28, 2016

Thanks all, I appreciate the fix. I've read the issue template for future reference, also will do a PR next time :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants