Hi,
I am trying to attach a number to the node of the tree based on the condition. So i am using a template to do the condition checking
private counttemplate: string = "{{if ${c} != \"0\" && ${c} != \"\"}}${title}<span style=\"font-weight:bold;color:#556B2F\">${c}</span>{{else}}${title}{{/if}}'";
seems like the igtree doesnt like this. but if i take of the condition checking and just do ${title}<span style=\"font-weight:bold;color:#556B2F\">${c}</span>
it works.
Please let me know how to make the templating work with igtree with angular 2 framework.
Hi Mike,
I tried the templating in angular app with igTree and it seems fine.
I used similar condition template and I'm sending my sample back to you.
Please review it and let me know if you need further assistance.
Hi i did try to download the sample project and do a npm install one it it seems like the ignite ui doesnt get pulled and if i do a npm install igniteui-angular2 to get the libarary its doesnt transpile it to js for me to use.
can you please review the project setting and send it back to me.
s
Hello Mike,
You are right the app I've send was using earlier version of igniteui-angular2 which was distributing igniteui.angular2.js file, but with the latest packages we've renamed the file to index.js for consistency with other npm packages.
Changing this main: 'igniteui.angular2.js', to main: 'index.js', in system.config.js will allow running the app without errors.
I'm also attaching the modified sample.
I tried to run it with my data structure looks like there is some issue with the tree not able to display when there is certain data value not included in the parent node.I have attached the sample project with data structure i am using. I wanted to know if there is a way to check if a data value exist within the template so that only the node with that value can apply the template.
The error i get in the console is
ERROR Error: An error has occurred while trying to retrieve data source property: ${c}
Is it a requirement to have the data source property to be in each and every node or is there a way for the template to check only to check for the node with has that particular data property.
Hello,
You cannot have undefined arguments inside of the condition of the template, because they cannot be evaluated.
One way to solve it is to populate null values for those properties in each node.
Another approach is to check for something which is always defined. For example {{if ${title} == 'Root'}}