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

[lit-html] Curly brackets {{text.}} are effective in templates #65

Open
t2ym opened this issue Feb 6, 2019 · 0 comments
Open

[lit-html] Curly brackets {{text.}} are effective in templates #65

t2ym opened this issue Feb 6, 2019 · 0 comments
Labels

Comments

@t2ym
Copy link
Owner

t2ym commented Feb 6, 2019

  • [lit-html] Curly brackets {{text.}} are effective in templates

Root Cause

  • Polymer template formats are used internally

Notes

  • This is not an issue but an internal gimmick, while depending on this behavior may be risky.
  • Effective Patterns as of 3.0.0-pre.26-lit-html.18
    • {{text.id}} - almost equivalent to ${this.text.id}
    • {{model.id}} - almost equivalent to ${this.text.model.id}
    • {{serialize(text.id)}} - almost equivalent to ${JSON.stringify(this.text.id)}

Examples

return html`${bind(this)}
  <i18n-format id="compound-format-text" class="text">
    <json-data>{
      "0": "No timezones",
      "1": "Only 1 timezone for {2} is shown.",
      "one": "{1} timezone other than {2} is shown.",
      "other": "{1} timezones other than {2} are shown."
    }</json-data>
    <i18n-number offset="1">${this.timezones.length}</i18n-number>
    <span>${'GMT' + (this.timezones[0] < 0 ? '' : '+') + (this.timezones[0] / 60)}</span>
  </i18n-format>
  <div>{{text.compound-format-text.0.0}}</div>
  <div>{{text.compound-format-text.0.1}}</div>
  <div>{{text.compound-format-text.0.one}}</div>
  <div>{{text.compound-format-text.0.other}}</div>
  <data-processor-element .data={{text.compound-format-text}}></data-processor-element>
`;
@t2ym t2ym added the wontfix label Feb 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant