Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Arguments in CallExpression are not watched - binding fails #59

Open
ghost opened this issue Dec 13, 2014 · 0 comments
Open

Arguments in CallExpression are not watched - binding fails #59

ghost opened this issue Dec 13, 2014 · 0 comments

Comments

@ghost
Copy link

ghost commented Dec 13, 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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants