-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
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
BC since 0.9.x - Object methods lose context when called #440
Comments
I probably broke it right around here: af38035 |
I like your loader, I'll reference it in our readme :) |
Thanks for looking into this! I've been looking into it myself but I haven't been able to put my finger on it... Feel free to reference to the twig-loader, it is also mentioned in the webpack docs (http://webpack.github.io/docs/list-of-loaders.html#templating) |
I made a PR for this issue: #455 |
Released in v1.10.3 |
I pass an object to the render function that has a getter method for this template:
The given model has a method
getBakedGood
that returnsthis.baked_good
from themodel
object.This worked fine with twig.js 0.8.9, I've put a working demo in fiddle:
https://jsfiddle.net/mathieumaes/f9px5c63/
I can't seem to get Twig.js 0.9.x and up to work in fiddle, but if you try the given use case in a project, The getter method will return undefined because the context in which the method is called is actually the "root" context of the twig template (aka.
{ model: Object }
, and not the givenmodel
object.The text was updated successfully, but these errors were encountered: