We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const velocity = require('velocityjs'); const context = { records: [{ ID: '1' }, { ID: '2' }, { ID: '3' }], }; const template1 = ` #foreach($item in $records) #set( $item.key = $item.ID ) #end $records `; // This does not behave as I'd expect. console.log(velocity.render(template1, context)); const template2 = ` #foreach($x in $records) #set( $item = $x ) #set( $item.key = $item.ID ) #end $records `; // This does not behave as I'd expect. console.log(velocity.render(template2, context));
In example above template1 doesn't change items on $records and original array gets rendered.
Currently, you have to copy loop variable into another variable, like in template2, to be able to change properties on items.
This is not a duplicate of #100
The text was updated successfully, but these errors were encountered:
fix: setting properties on loop variable from foreach doesn't work
123f8bc
close #129
new version 2.0.1 published
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
In example above template1 doesn't change items on $records and original array gets rendered.
Currently, you have to copy loop variable into another variable, like in template2, to be able to change properties on items.
This is not a duplicate of #100
The text was updated successfully, but these errors were encountered: