Good Day All,
I am building an API that needs to evaluate expressions outside of the
normal web view (configuration file). I was hoing to use the
polymer-expression code to manually evaluate expressions defined in a JSON
configuration file and apply a model / context. I have got a sample working
as long as I do not add any context variables to it
By doing
...
<script src="/javascript/esprima.js"></script>
<script src="/javascript/polymer-expressions.js"></script>
var myExpression = PolymerExpressions.getExpression("2 * 3 + 2");
var result = myExpression.expression();
...
However how would I go about passing a model/context so I can evaluate
against variables using this manual process?, Not sure what I am doing
wrong any help pointing me in the right direction would be appreciated
var model = { X: 1 };
var myExpression = PolymerExpressions.getExpression("2 * 3 + X");
var result = myExpression.expression(model);
Thanks
Ashley
Follow Polymer on Google+: plus.google.com/107187849809354688692
---
You received this message because you are subscribed to the Google Groups
"Polymer" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/polymer-dev/fc02130e-4c15-48aa-a35a-b803e84b8660%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.