I'm writing an accordion widget based on JQuery.accordion that should be definied in the markup as follows:
<my-accordion ...>
<my-section title="title-expr1">
section 1 contents goes here
</my-section>
<my-section title="title-expr2">
section 2 contents goes here
</my-section>
...
</my-accordion>
My implementation defines two directives (one for accordion container and one for section definition) but I have the following problem:
the rendered section should have the following HTML:
<h3><a href="#">Section 1</a></h3>
<div>
<p>
[section contents] (ng-transclude)
</p>
</div>
So the template must be someting similar to
<h3><a href="#">{{title}}</a></h3>
<div>
<p ng-transclude>
</p>
</div>
BUT, templates must have only one single root element.
I tried to use a template like
<div>
<h3><a href="#">{{title}}</a></h3>
<div>
<p ng-transclude>
</p>
</div>
</div>
but it doesn't render correctly when '.accordion' is applied.
I had a similar problem with 'radio buttons' where the template requires an input tag and a sibling label; in that case I solved surroding with a span (that didn't broke rendering on buttonset).
Any best practice to follow? Any idea?
Thank you.