Populate method in Template: Not working as expected [message #1750658] |
Sat, 24 December 2016 05:08 |
John Dawes Messages: 19 Registered: November 2016 |
Junior Member |
|
|
Hi,
Please find my code below.
var template:Template = TemplateFactory.load("body.egl");
for(class:Mine!Class in Class.allInstances) {
template.populate("cls", class);
template.generate(class.name + ".java");
}
Here I am calling the 'body.egl' file which has a variable called 'cls'. I was expecting the 'cls' variable to have different values inside the 'body.egl' file depending on the value of the 'class' variable in the for loop. Surprisingly, although it generates files with different names for different loop iterations, for different instances of 'body.egl' content, it only uses the value assigned to it during the first loop iteration. Am I wrong in terms of my expectation? Should I do it differently for making a variable available in the 'body.egl' file?
Thanks
[Updated on: Sat, 24 December 2016 05:10] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05121 seconds