Skip to content
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

Add JavaScript expressions to the template #79

Closed
Buslowicz opened this issue Jun 30, 2017 · 2 comments
Closed

Add JavaScript expressions to the template #79

Buslowicz opened this issue Jun 30, 2017 · 2 comments
Assignees

Comments

@Buslowicz
Copy link
Owner

Make it possible to use JavaScript expressions in the templates, instead of simple properties binding. Expressions should be changed to either functions or computed properties.

@Buslowicz Buslowicz self-assigned this Jun 30, 2017
@tpluscode
Copy link
Contributor

Hm, I don't think it's a good idea. This diverges too much from plain Polymer IMO and break the principle of least astonishment. TWC already greatly improves compute function and properties. Do you think it is not enough?

@Buslowicz
Copy link
Owner Author

Buslowicz commented Jun 30, 2017

When working on the previous Polymer project, we had a big pain creating a method for every even the simplest expression. As in many cases it might be business logic, sometimes it is pure UI logic and should not pollute the class. Also it is optional, so nobody would be forced to use it ;). I was planning to only add that when using template() method to provide a template. If using a template string inside, people would most likely try to use expressions with ${ ... } and if expressions were not supported, it would break the native TypeScript feeling. For example:

template() {
  return `<template is="dom-if" if="${this.type === "someType"}"> ... </template>`;
}

There are very many cases like that and it's just simpler to use this kind of expression than to use methods for that.

Buslowicz pushed a commit that referenced this issue Jul 10, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants