We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Error using templates: "Cannot read property template of undefined"

One of the last version updates seems to have broken the ability to use templates in at least these components
  • Dropdown List
  • MultiSelect Dropdown
  • Menu
The dropdown list does not show the right items, when using a template like in the offical samples (copy from demos https://ej2.syncfusion.com/angular/demos/#/material/drop-down-list/template).  Error message in the browser console:

ERROR TypeError: Cannot read property 'template' of undefined
    at eval (template.js:44)
    at eval (dom.js:426)
    at Object.s.renderContentTemplate (list-base.js:535)
    at DropDownListComponent.l.templateListItem (list-box.js:2305)
    at DropDownListComponent.l.renderItems (list-box.js:2305)
    at DropDownListComponent.eval (list-box.js:2305)
    at DropDownListComponent.e.trigger (template.js:44)
    at DropDownListComponent.eval (list-box.js:2305)
    at DropDownListComponent.e.trigger (template.js:44)
    at DropDownListComponent.l.setListData (list-box.js:2305)

Using the source code from the sample page:
<ejs-dropdownlist id='employees' [dataSource]='data' [fields]='fields' [popupHeight]='height' [placeholder]='watermark'>
    <ng-template #headerTemplate>
        <div class="head"> <span class="photo">Photo</span> <span style="margin-left:17px;">Employee Info</span></div>
    </ng-template>
    <ng-template #itemTemplate let-data>
        <div><img class="empImage" src="./assets/auto-complete/Employees/{{data.Eimg}}.png" alt="employee" />
            [...]
        </div>
    </ng-template>
    <ng-template #valueTemplate let-data>
       [...]
    </ng-template>
</ejs-dropdownlist>
The issue can be reproduced from the demos, when launching the "Stackblitz" links like from these pages
  • https://ej2.syncfusion.com/angular/demos/#/material/drop-down-list/template
  • https://ej2.syncfusion.com/angular/demos/#/material/multi-select/template
  • https://ej2.syncfusion.com/angular/demos/#/material/combo-box/template
I do see the very same error messages in my local development environment. Any hints what needs to be done to make this work?

6 Replies 1 reply marked as answer

PM Ponmani Murugaiyan Syncfusion Team September 21, 2020 07:01 AM UTC

Hi Alexander,  

Greetings from Syncfusion support.  

We have confirmed the reported issue as a bug in our end and the fix will be available in our upcoming patch release which is expected to be rolled out on September 23, 2020. You can track the status of the bug in the below feedback link.  We appreciate your patience until then.  


Regards,  
Ponmani M 



AH Alexander Heim September 21, 2020 08:45 AM UTC

Hi Ponmani,

Good to hear. Thanks for your quick reply!
Alexander


PM Ponmani Murugaiyan Syncfusion Team September 22, 2020 05:13 AM UTC

Hi Alexander, 

Thanks for the update. The fix for the reported issue will be included in this weekly patch release as per our previously promised date. We appreciate your patience until then. 

Regards, 
Ponmani M  



PM Ponmani Murugaiyan Syncfusion Team September 22, 2020 06:59 AM UTC

Hi Alexander, 

Thanks for the patience. 

We are glad to announce that our latest release in the version 18.2.59 has been rolled out successfully and in that release, we have included the “DropDownList template throws error from list package”.  So, we suggest you to upgrade our Syncfusion packages to our latest version to resolve this issue in your end. 

Please find the release notes details from the below link. 



Please get in touch with us if you would require any further assistance.    

Regards, 
Ponmani M  


Marked as answer

AH Alexander Heim September 22, 2020 03:50 PM UTC

Yes - I confirm it's working again! Thanks again for the quick solution!

Regards,
Alexander


PM Ponmani Murugaiyan Syncfusion Team September 23, 2020 04:47 AM UTC

Hi Alexander, 

Most welcome. Please get back us if you need further assistance. 

Regards, 
Ponmani M 


Loader.
Up arrow icon