Primeng: Lazy-Loaded Accordion Tab Content Not Loading If Initialised as ActiveIndex

Created on 17 Sep 2019  路  1Comment  路  Source: primefaces/primeng

I'm submitting a ... (check one with "x")

[X] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Plunkr Case (Bug Reports)
Please see my StackBlitz

https://stackblitz.com/edit/github-bbyyu9

Current behavior
When I'm trying to lazily load Child Component inside Accordion tab it's not opening if it's initialised as ActiveIndex. But If I'm closing the active tab and again opening it then it's working

Expected behavior
Child Component should load lazily if it's initialised as ActiveIndex.

Please tell us about your environment:

  • Angular version: 7.2.7

  • PrimeNG version: 8.0.0

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

  • Language: [TypeScript 3.2.4]

  • Node (for AoT issues): node --version = 8.15.1

pending-review

Most helpful comment

We also have this issue in PrimeNg 10.0.3.

When adding <ng-template pTemplate="content"> to the content of the accordion tab the content is not being loaded when you programmatically set the active accordion-tab ([selected]).

Workaround for this isssue is to call the toggle method on the AccordionTab that you want to display:
html:

<p-accordion
   #accordion>
   ...
</p-accordion

ts:

@ViewChild('accordion') accordion: Accordion;
toggle(index: number) {
    this.accordion.tabs[index].toggle(new Event('toggle'));
    this.cdr.detectChanges();
}

Hope this helps to resolve the issue!

Best Regards,
Ivar Kanters

>All comments

We also have this issue in PrimeNg 10.0.3.

When adding <ng-template pTemplate="content"> to the content of the accordion tab the content is not being loaded when you programmatically set the active accordion-tab ([selected]).

Workaround for this isssue is to call the toggle method on the AccordionTab that you want to display:
html:

<p-accordion
   #accordion>
   ...
</p-accordion

ts:

@ViewChild('accordion') accordion: Accordion;
toggle(index: number) {
    this.accordion.tabs[index].toggle(new Event('toggle'));
    this.cdr.detectChanges();
}

Hope this helps to resolve the issue!

Best Regards,
Ivar Kanters

Was this page helpful?
0 / 5 - 0 ratings

Related issues

just-paja picture just-paja  路  3Comments

markgoho picture markgoho  路  3Comments

miresk picture miresk  路  3Comments

KannanMuruganmony picture KannanMuruganmony  路  3Comments

mitosandov picture mitosandov  路  3Comments