Search code examples
javascriptangularng-lightning

Is it possible to have the label of an nglAccordionSection accordion as a component or html element instead of just text?


I want to create a nesting table in Angular using Ng-lightning. I'm trying to do that by adding tables inside of an accordion.

However, I can't seem to find a way to set the label of the nglAccordionSection as a component or element instead of just text.

Other solutions besides adding tables to accordions are welcome as well.


Solution

  • Check the "Custom reusable header" example at http://ng-lightning.github.io/ng-lightning/#/components/accordion. There you can see that you can use ng-template as value of the [label].

    For example:

    <ng-template #header>html header</ng-template>
    <ul ngl-accordion [(activeName)]="active">
      <ng-template nglAccordionSection name="A" [label]="header">Content area</ng-template>
    </ul>