AccordionItems are not updated as desired using ngFor

Hi!

I encountered a problem updating my AccordionItems. 
I created a template like this:

    <ejs-accordion #accordion>
      <e-accordionitems>
        <e-accordionitem
          *ngFor="let accordionItem of accordionItems"
          expanded="true"
        >
          <ng-template #header>
            <div>{{ accordionItem.titleVar }}</div>
          </ng-template>
          <ng-template #content>
            <div>{{ accordionItem.contentVar }}</div>
          </ng-template>
        </e-accordionitem>
      </e-accordionitems>
    </ejs-accordion>


So, my accordion items should be dynamically created using ngFor and an accordionItems-variable containing title and content. 


When I then try to update this accordionItems-variable, the accordion is not updated correctly. 

Please refer to the following stackblitz sample: https://stackblitz.com/edit/ej2-accordion-syncfusion-angular-y3u1cg?file=app.component.ts

On the first button click, the three accordion items that are already on the screen are updated with the correct values, but the additional item is not added. 

On the second button click, there are still three items, but also the first ones lose their correct data for display.

First, I thought that it is a change detection problem connected to ngFor, but obviously angular recognizes the change and does something. But its not the desired reaction. 

Can you explain this weird behaviour?

Thanks in regard
Jonas!



1 Reply

RM Ruksar Moosa Sait Syncfusion Team August 12, 2022 05:38 AM UTC

Hi Jonas,


We have checked on your shared sample and let you know that we have already noted and fixed the reported issue and it working fine in the version (20.1.0.47). Hence, if possible we suggest you update the Syncfusion package to 20.1.0.47 to resolve the issue. We have prepared a working sample for your reference.


Sample: https://stackblitz.com/edit/ej2-accordion-syncfusion-angular-szetvl?file=app.component.ts


Regards,

Ruksar Moosa Sait


Loader.
Up arrow icon