Lazy-Loaded Accordion Tab Content Not Loading If Initialised as ActiveIndex
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
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
Hi,
So sorry for the delayed response! Improvements have been made to many components recently, both in terms of performance and enhancement. Therefore, this improvement may have been developed in another issue ticket without realizing it. You can check this in the documentation. If there is no improvement on this, can you reopen the issue so we can include it in our roadmap? Please don't forget to add your feedback as a comment after reopening the issue. These will be taken into account by us and will contribute to the development of this feature. Thanks a lot for your understanding!
Best Regards,