I tried Seth answer and the expressions themselves are working but somehow I am losing events on my component.
My on-click
event was not working anymore when I was using:
DocumentFragment instanceTemplate(Element template) =>
template.createInstance(this,
new PolymerExpressions(globals: {
'uppercase': (String input) => input.toUpperCase()
}));
I also tried the solution proposed on the polymer expressions page but the binding delegate is apparently missing. Because of a new version maybe?
Anyway, after looking into the code I found another way to have expressions and also to keep events working.
class MyElement extends PolymerElement {
MainElement.created() : super.created();
@override
BindingDelegate syntax = new MyPolymerExpressions();
}
class MyPolymerExpressions extends PolymerExpressions {
MyPolymerExpressions(): super(globals: {
'uppercase': (String input) => input.toUpperCase()
});
@override
prepareBinding(String path, name, node) => Polymer.prepareBinding(path, name, node, super.prepareBinding);
}
I noticed that events are working the prepareBinding
method is overrided.
If anyone has a better way to do it or some thoughts about this, I am quite interested!