-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Support for expressions and filters #1847
Comments
That is still not possible, what you can do is alter the binding with computed bindings: https://www.polymer-project.org/1.0/docs/devguide/data-binding.html#annotated-computed |
@tam4s you can do
Polymer is designed for building Web Components, it's not primarily focused on being a general purpose templating library. |
Rob's comment covers Polymer's current behavior. We consider new features based on user feedback. Thanks for your comments. |
What's wrong with binding expressions?
Where to express the feedback? I'll post here.
...Then tell us how to use a "general purpose templating library" when writing Polymer components. I have yet to see a solution. Do you agree that not having expressions inside HTML feels backwards nowadays? I mean, do you deny Binding/Templating Expression's popularity? To me, it is very easy to understand and attractive. We cannot say the same for computed bindings / filters! They are hard to read (unless you are really good with your naming conventions), not easy to code (have to not only create a piece of code completely elsewhere but one has to give it a name even for simple things like "{{index%2==0}}". Half-baked solution: From a high level: |
@popbee I would like this too, please express your feedback also here: |
Sure did. I will support any effort to have better "extrapolations" (or whatever they like to call it) with Polymer. Either within the core (better as everybody would align) or at least a solution supported by Polymer docs / people (or anything going in that direction). AFAIK I have yet to see a [good] demonstration of why this would be "wrong" or would slow down anything. I am opened to hear it. I must confess that this very feature [or lack thereof] is what "killed" Polymer for me. As of now, I did not upgrade existing projects to 1.0 and went the ReactJS [& related] route for new ones. |
It might be that having expressions and filters introduce a performance hit where used - but from a development standpoint, it's VERY useful to have. Some examples:
With the current "solution" in 1.x, you will need something like a super-master-behavior, inherited by ALL elements (including built-in) that has a ton of functions to compensate for missing filters and expressions - OR make custom functions and inheritance of built in elements all over. In any case, the templates will become filled with function calls and it will not be easy to understand the exact behavior at first glance. In the larger web projects, I've been working on (angular & some ember), I'd say filters were used in maybe 25% of the rendered bindings to make things easily localizable, custom formatted, etc. + the occational simple calculation or bit mask. |
These things below should work, because adding a full element with script tag in order to make simple things work prevents adoption of Polymer.
The text was updated successfully, but these errors were encountered: