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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

NodeTemplate throws: ERROR TypeError: str.replace is not a function at evalExp (vendor.js:108640) ...

Thread ID:

Created:

Updated:

Platform:

Replies:

141140 Nov 26,2018 02:14 PM UTC Nov 29,2018 06:01 AM UTC Angular - EJ 2 5
loading
Tags: Treeview
Jon Andoni
Asked On November 26, 2018 02:14 PM UTC

Hello,

I´m trying to use  template in angular treeview following the next demo: https://ej2.syncfusion.com/angular/documentation/treeview/template .
The issue is that for the moment that render the treeview without template it renders ok but when I add <ng-template  nodeTemplate="" let-data="">... the chrome console throws the next lines: 
ERROR TypeError: str.replace is not a function
    at evalExp (vendor.js:108640)
    at compile (vendor.js:108625)
    at Object.push../node_modules/@syncfusion/ej2-angular-navigations/node_modules/@syncfusion/ej2-base/src/template-engine.js.Engine.compile (vendor.js:108554)
    at compile (vendor.js:108513)
    at TreeViewComponent.push../node_modules/@syncfusion/ej2-angular-navigations/node_modules/@syncfusion/ej2-navigations/src/treeview/treeview.js.TreeView.templateComplier (vendor.js:139371)
    at TreeViewComponent.push../node_modules/@syncfusion/ej2-angular-navigations/node_modules/@syncfusion/ej2-navigations/src/treeview/treeview.js.TreeView.initialize (vendor.js:139332)
    at TreeViewComponent.push../node_modules/@syncfusion/ej2-angular-navigations/node_modules/@syncfusion/ej2-navigations/src/treeview/treeview.js.TreeView.render (vendor.js:139316)
    at TreeViewComponent.push../node_modules/@syncfusion/ej2-angular-navigations/node_modules/@syncfusion/ej2-base/src/component.js.Component.appendTo (vendor.js:103183)
    at vendor.js:100559
    at ZoneDelegate.push../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:2766)

Do you have any solution to this issue?

Christopher Issac Sunder K [Syncfusion]
Replied On November 27, 2018 07:37 AM UTC

Hi Jon Andoni, 

Thank you for contacting Syncfusion support. 

We have checked your reported problem at our end. We suspect that the template content is initialized improperly in ng template. Could you please ensure the ng template content in TreeView? 

<ejs-treeview id="tree" [fields]="field" [cssClass]="cssClass"> 
      <!-- Template to render tree node --> 
       <ng-template #nodeTemplate="" let-data=""> 
       <div> 
       <img class="eimage" src="https://ej2.syncfusion.com/demos/src/treeview/images/employees/{{data.eimg}}.png" alt="{{data.eimg}}"/> 
            <div class="ename">{{data.name}}</div> 
            <div class="ejob">{{data.job}}</div> 
       </div> 
       </ng-template> 
</ejs-treeview> 


Please share the template content with tree view and its bounded data source if you are still facing the sample problem. 

Thanks,
Christo


Jon Andoni
Replied On November 27, 2018 12:54 PM UTC

Hello Christo,


This is the template content:

<ejs-treeview #tree [fields]='field' (nodeClicked)="onNodeClick($event)" [cssClass]='cssClass'>
<ng-template #nodeTemplate="" let-data="">
<div>
Test
div>
ng-template>
ejs-treeview>

It´s seems to be good.

Fields charge a javascript array object that contains properties like text, id etc, but it doens´t matter because in this example i´m not binding any data. This same example in stackblitz works fine, test it.



Christopher Issac Sunder K [Syncfusion]
Replied On November 28, 2018 07:35 AM UTC

Hi Jon Andoni, 

Thanks for the update. 

We tried hard to reproduce your reported problem at our end. But ng-template concepts works fine for our TreeView component. As per your scenario, we have checked your problem on both stackblitz application and local angular-cli application, but we were unable to reproduce it. Could you please check the samples? 


Local Angular CLI application:  


You can use the below command to install the npm packages and run it. 

  1. npm install
  2. ng serve

Still you are facing the same issue, Could you please share the below information? 

  1. Syncfusion angular navigations package version
  2. Which way you have used our angular navigations’ TreeView component in your application(Angular-cli, webpack, etc…)
  3. If possible, please try to reproduce the issue with the provided sample or send us other any sample which reproduces the issue.

Thanks, 
Christo

Jon Andoni
Replied On November 28, 2018 01:16 PM UTC

Hello Christo,

Thanks for example in stackblitz and on angular-cli project.

Finally, the error was that with npm i @syncfusion/ej2-angular-navigations I installed the 16.6.30 version and ng-template doesn´t work with this version. So I update to the 16.6.34 version and it works.

Thank you.





Christopher Issac Sunder K [Syncfusion]
Replied On November 29, 2018 06:01 AM UTC

Hi Jon Andoni, 

We are glad to hear that the issue has been resolved at your end. Please let us know if you need any further assistance. 

Thanks,
Christo


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;