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

Polymer 0.8 cant bind to array item. #1409

Closed
mwinters-stuff opened this issue Apr 14, 2015 · 1 comment
Closed

Polymer 0.8 cant bind to array item. #1409

mwinters-stuff opened this issue Apr 14, 2015 · 1 comment

Comments

@mwinters-stuff
Copy link

This we could do in 5.x

Using an array property/attribute which is populated with an 'associative' array of values, There is an error on the bind..

Eg.

Setup and element with a property (we are using this for translating the page)

  translations:{
          value: [],
          type: Array,
          notify: true,
          readOnly: true
        },

populate translations with an array of Objects. eg.

var trans = [];
trans['id-one'] = 'one';
trans['id-two'] = 'two';
this._setTranslations(trans);

Then

use the element.

    <translator-json translations="{{translations}}" ></translator-json>
    <paper-button raised="true">[[translations['id-one']]]</paper-button>
    <paper-button raised="true">[[translations['id-two']]]</paper-button>

Results in an error in bind.html
unexpectedIdentifier

it creates a setter

"var old = this._setData('translations['id-one']', value);
if (value !== old) {
  this._translations['id-one']Effector(old);
}"
@kevinpschaaf
Copy link
Member

We do not plan to support [...] bracket dereferencing in 0.8+, as we are avoiding use of a full JS expression parser for performance and simplicity.

However, this syntax will work: [[translations.id-one]].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants