Welcome to the Angular feedback portal. We’re happy you’re here! If you have feedback on how to improve the Angular, we’d love to hear it!>
Thanks for joining our community and helping improve Syncfusion products!
When using a custom template (for angular, ng-template) in your Treeview control, viewContainers are not cleared when a new datasource is set.
Here is a link to your "Angular template compiler" used for creating new nodes using custom templates.
But here you are simply clearing your innerHTML of your ejs-treeview before you generate new nodes. This will cause an issue with templates containing components with subscriptions, as these will never have the ngOnDestroy callback function called.
Our solution (a temporary one..) to this problem was to create a new directive and apply it to the ng-template with #nodeTemplate. Then on new datasource reference, access the viewContainerRef (like you do here) and call "clear()".
This is a big issue if you (like we did) implement a search feature, and bind treeviewFields model multiple times (which you have to..).
Implementation of viewContainerRef.clear() is missing and is required to prevent massive changeDetection issues.