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

Arguments in the function expressions are not watched - binding fails #1021

Closed
ghost opened this issue Dec 12, 2014 · 1 comment
Closed

Arguments in the function expressions are not watched - binding fails #1021

ghost opened this issue Dec 12, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Dec 12, 2014

According to official docs "The function’s arguments are observed for changes, and the expression is re-evaluated whenever one of the arguments changes" (https://www.polymer-project.org/docs/polymer/expressions.html).

However when running following example we can see that Names list is not updated after a change in the names object.

   <func-binding></func-binding>

    <polymer-element name="func-binding">
      <template>
        Names (not updated):
        <ul>
          <template repeat="{{key in keys(names)}}">
            <li>{{key}}: {{names[key]}}</li>
          </template>
        </ul>
        Ages (updated):
        <ul>
          <template repeat="{{age in ages}}">
            <li>{{age}}</li>
          </template>
        </ul>
      </template>
      <script>
        Polymer({
          names: {
            a: "John",
            b: "James"
          },
          ages: [20, 30],
          ready: function() {
            var self = this;
            setTimeout(function() {
              self.names.c = "Bob";
              self.ages.push(40);
            }, 1000);
          },
          keys: function(obj) {
            return obj == undefined ? [] : Object.keys(obj);
          },
        });
      </script>
    </polymer-element>
@ghost
Copy link
Author

ghost commented Dec 14, 2014

Closing and moving issue here: googlearchive/polymer-expressions#59

@ghost ghost closed this as completed Dec 14, 2014
This issue was closed.
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

0 participants