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

[0.8] Using one-way binding to propagate upward #1360

Closed
ragingwind opened this issue Apr 2, 2015 · 1 comment
Closed

[0.8] Using one-way binding to propagate upward #1360

ragingwind opened this issue Apr 2, 2015 · 1 comment

Comments

@ragingwind
Copy link
Contributor

An examples in Polymer primer, one-way binding for upward in Property change notification and Two-way binding is not working properly as much as I thought.

  • With notify:true and readOnly:true: I couldn't change to 'prop' anyway.
  • With notify:false and readOnly:true: I could change to 'prop' but never notify to host
<dom-module id="custom-elements">
  <template>
    <custom-element prop="{{value}}"></custom-element>
  </template>
</dom-module>

<script>
  Polymer({
    is: "custom-elements",

    properties: {
      value: {
        type: String,
        observer: 'valueChanged'
      }
    },

    valueChanged: function(newVal, oldVal) {
      console.log('Host value has been changed', newVal);
    }
  })

  Polymer({
    is: 'custom-element',

    properties: {
      prop: {
        type: String,
        notify: false,
        readOnly: true,
      }
    },

    ready: function() {
      this.prop = "from child";
      console.log(this.prop); // out "from child" if notify is false else out undefined
    }
  });
</script>
@ragingwind
Copy link
Contributor Author

Sorry. answer is in the primer doc downward. I have to use _setProp

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

1 participant